unsigned long swap_bytes(unsigned long n) {
unsigned char bytes[8];
unsigned long temp;
bytes[0] = (n >> ??) & 0xff;
bytes[1] = (n >> ??) & 0xff;
// ...
}
I am really confused on how to shift an 8 byte unsigned long
from
ex: 0x12345678deadbeef
to 0x34127856addeefbe
. I started this but I am now stuck. Please help.