FANDOM


Hello World Edit

#include <stdio.h>
int main(int argc, char** argv){
  printf("Hello World\n");
  return 0;
}

strcpy Edit

void strcpy(char *s, const char *t)
{
    while (*s++ = *t++);
}

IEEE floating-point fastsqrt Edit

float fastsqrt(float val) {
    int tmp = *(int *)&val;
    tmp -= 1<<23; /* Remove last bit to not let it go to mantissa */
    /* tmp is now an approximation to logbase2(val) */
    tmp >>= 1;    /* divide by 2 */
    tmp += 1<<29; /* add 64 to exponent: (e+127)/2 =(e/2)+63, */
                  /* that represents (e/2)-64 but we want e/2 */
    return *(float *)&tmp;
}

xor_swap Edit

void xor_swap (int *x, int *y)
{
    if (x != y) {
        *x ^= *y;
        *y ^= *x;
        *x ^= *y;
    }
}

IEEE floating-point invsqrt Edit

float invSqrt(float x)
{
    float xhalf = 0.5f*x;
    int i = *(int *)&x;
    i = 0x5f3759df - (i >> 1);
    x = *(float *)&i;
    x = x * (1.5f - xhalf * x * x);
    return x;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.