A challenge -- C preprocessor expression for machine's `endian-ness'?
Eric S. Raymond
eric at snark.uu.net
Mon Feb 26 03:00:32 AEST 1990
I'm tuning and adapting Ralph Merkle's snefru code for use as a netnews
authentication tag. It would be immensely useful if I could do the following:
#if (<unknown-expression>)
#define LITTLE_ENDIAN /* machine words have LSB first */
#else
#define BIG_ENDIAN /* machine words have MSB first */
#endif
For those of you who don't recall, the expression may use constants of
integral type, sizeof(), unary ops - ~ and !, binary ops + - / * << >> == != <
<= > >= & ^ | && ||, the ternary op ?: and casts. Parentheses for grouping
are permitted. Can anyone come up with such an expression?
Please reply by email. Results will be summarized to comp.lang.c.
--
Eric S. Raymond = eric at snark.uu.net (mad mastermind of TMN-Netnews)
More information about the Comp.unix.wizards
mailing list