mirror of
https://github.com/Interlisp/maiko.git
synced 2026-02-18 05:24:05 +00:00
Detect byte order from preprocessor definition (#330)
Rather than having to specify or omit -DBYTESWAP in the Makefile fragment for each system we can detect whether the system requires byte swapping based on the __BYTE_ORDER__ C preprocessor definition. Update CMakeLists.txt to account for this as well.
This commit is contained in:
@@ -137,6 +137,18 @@
|
||||
# define MAIKO_ARCH_DETECTED 1
|
||||
#endif
|
||||
|
||||
#if defined(__BYTE_ORDER__)
|
||||
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define BYTESWAP 1
|
||||
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# undef BYTESWAP
|
||||
# else
|
||||
# error "Unknown byte order"
|
||||
# endif
|
||||
#else
|
||||
# error "Could not detect byte order"
|
||||
#endif
|
||||
|
||||
#ifndef MAIKO_OS_DETECTED
|
||||
# error "Could not detect OS."
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user