>> #define WORDS_BIGENDIAN 1 >Did waf's endian-ness test not detect this properly?
waf's detection worked fine. The above #define is from config.h on a PowerPC indicating what it did. --------- > ISTR years ago seeing some C magic, where in a compile time declaration, one > packs bytes into a struct union with an integer, and then at runtime looks > at the integer value to determine the endianess on the fly. Downside: it has > to be tested at runtime, which means the compile time optimizer is less > likely to remove the unused code paths. I've seen that sort of code. It wouldn't take me long to make something similar. > Is it the case that the C standard or the POSIX standard do not define a > standard #define that tells the current endianess? That seems like just the > sort of thing that the standard should do... Fedora has a /usr/include/endian.h I don't know if that's part of POSIX. Our code just includes it, no #ifdefs, so I assume it is. waf has a builtin. if ctx.check_endianness() == "big": ctx.define("WORDS_BIGENDIAN", 1) ----------- There are 2 places in our code that know about endianness. Several refclocks check WORDS_BIGENDIAN and do their own thing. It's used for things like binary ints/floats sent over a serial port. The packet format on the internet is big endian. There is code that swaps when necessary in ntpd/ntp_proto.c via libntp/ntp_endian.c We could probably clean up both areas by using endian.h Eric: looks like an item for your list. -- These are my opinions. I hate spam. _______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel