Xref: utzoo comp.lang.c:26300 comp.arch:14222 comp.unix.wizards:20764 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cbmvax!snark!eric From: eric@snark.uu.net (Eric S. Raymond) Newsgroups: comp.lang.c,comp.arch,comp.unix.wizards Subject: A challenge -- C preprocessor expression for machine's `endian-ness'? Message-ID: <1VZjQh#7Lz9by=eric@snark.uu.net> Date: 25 Feb 90 16:00:32 GMT Followup-To: poster Lines: 17 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 () #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@snark.uu.net (mad mastermind of TMN-Netnews)