I remembered the fast inverse square root algorithm from quake 3 and wanted to do some bit shenanigans.
#include <stdio.h>
int main()
{
unsigned int x[2] = {0xffffffff, 0x0f01};
unsigned long y = * (long *) &x[0];
unsigned long z = ((unsigned long)x[1] << 32) + x[0];
printf("x[0] = %x, x[1] = %x\n(x[1] << 32) + x[0] = %lx\ny = %lx", x[0], x[1], z, y);
return 0;
}
and it outputs this
x[0] = ffffffff, x[1] = f01
(x[1] << 32) + x[0] = f01ffffffff
y = f01ffffffff
Is it supposed to be doing this?