mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Workarounds for older gcc releases such that endian.h works.
This commit is contained in:
parent
86f8662a4e
commit
78300931ba
1 changed files with 14 additions and 1 deletions
|
@ -25,12 +25,25 @@
|
|||
#ifndef SORTIX_ENDIAN_H
|
||||
#define SORTIX_ENDIAN_H
|
||||
|
||||
// Work around older GCC versions that do not define this.
|
||||
#if !defined(__BYTE_ORDER__) && (defined(__i386__) || defined(__x86_64__))
|
||||
#if !defined(__ORDER_LITTLE_ENDIAN__)
|
||||
#define __ORDER_LITTLE_ENDIAN__ 1234
|
||||
#endif
|
||||
#if !defined(__ORDER_BIG_ENDIAN__)
|
||||
#define __ORDER_BIG_ENDIAN__ 4321
|
||||
#endif
|
||||
#if !defined(__BYTE_ORDER__)
|
||||
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __BYTE_ORDER__
|
||||
#error Your compiler needs to define the __BYTE_ORDER__ macro family.
|
||||
#endif
|
||||
|
||||
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ && \
|
||||
__BYTE_ORDER__ != __ORDER_BIG_ENDIAN
|
||||
__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
|
||||
#error Exotic endian detected, you need to port this header.
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue