This seems to work nicely
#include <stdio.h>
int main(int argc, const char * argv[])
{
uint64_t i = 0xffffffffffffffff;
uint64_t j = 0xaaaaaaaaaaaaaaaa;
uint64_t k = i ^ j;
printf("%qu\n",k);
return 0;
}
Or, here’s another way if you want to make it a bit more flexible…
#include <stdio.h>
uint64_t test(unsigned int numBits) {
uint64_t i = 0x01, j = 0, k = 0;
for (int x = 0; x < 64; x++) {
j = i;
k = j << 2;
i = k | i;
}
return i;
}
int main(int argc, const char * argv[])
{
uint64_t num = test(64);
printf("%qu\n",num);
return 0;
}