In a 64-bit number Like XOR Higher order 32 bits with a low order 32 bits. thank you
(v & 0xffffffff) ^ ((v >> 32) & 0xffffffff)
Just for kicks, here's another solution. This is probably the one that already exists.
uint32_t* number32; uint64_t number64 = 0xffff1111ffffffff; uint32_t xorValue; number32 = (uint32_t*)&number64; xorValue = number32[0]^number32[1];
uint32_t hi_low_xor(uint64_t x) { return static_cast<uint32_t>(x) ^ static_cast<uint32_t>(x >> 32); }
if you want to save the result in lower 32 bits:
(v & 0xffffffff) ^ ((v >> 32))
if you want to save the result in higher 32 bits:
((v & 0xffffffff) ^ ((v >> 32))) << 32