1
0
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:
Nick Briggs
2021-01-31 16:56:35 -08:00
committed by GitHub
parent 70db63449c
commit 261069f131
20 changed files with 30 additions and 31 deletions

View File

@@ -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