Endianness puzzle
Hal Murray
hmurray at megapathdsl.net
Tue Dec 13 01:16:33 UTC 2016
Disclaimer: I could easily get something backwards. I've worked with both
and can easily switch even when I shouldn't.
> +#define LAST32MASK 0x00000000ffffffffUL
> +#define FIRST32MASK 0xffffffff00000000UL
FIRST and LAST seem like poor choices for words. Do you mean first on the
wire? Network protocols are almost always little endian.
In any case, those masks are not within an ifdef so they will be used in both
cases.
If you want the low or high bits, the masks and macros don't depend on the
endianness if you are extracting from a uint64_t. You may need to invent a
new host2net type macro to byte swap an 8 byte chunk if you want to
send/receive those chunks from the network.
--
These are my opinions. I hate spam.
More information about the devel
mailing list