diff --git a/options/ansi/include/bits/ansi/timespec.h b/options/ansi/include/bits/ansi/timespec.h index 926d8e7f3c..13a6e546e6 100644 --- a/options/ansi/include/bits/ansi/timespec.h +++ b/options/ansi/include/bits/ansi/timespec.h @@ -12,7 +12,7 @@ struct timespec { time_t tv_sec; // tv_nspec is required to be long by the C standard. // However linux kernel expects long long. So we add padding. - __MLIBC_FIELD_PADDED(long, tv_nsec, long long); + __MLIBC_FIELD_PADDED(long, long long, tv_nsec); }; #endif // MLIBC_TIMESPEC_H diff --git a/options/internal/include/bits/field-padding.h b/options/internal/include/bits/field-padding.h index 7fe9a95fb2..935953613d 100644 --- a/options/internal/include/bits/field-padding.h +++ b/options/internal/include/bits/field-padding.h @@ -1,15 +1,9 @@ #ifndef MLIBC_FIELD_PADDING_H #define MLIBC_FIELD_PADDING_H -#ifdef __GNUC__ - -#define __MLIBC_FIELD_PADDED(T, F, PT) \ - PT : (sizeof(PT)-sizeof(T))*8*(BYTE_ORDER == BIG_ENDIAN); \ +#define __MLIBC_FIELD_PADDED(T, AT, F) \ + AT : (sizeof(AT)-sizeof(T))*8*(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__); \ T F; \ - PT : (sizeof(PT)-sizeof(T))*8*(BYTE_ORDER == LITTLE_ENDIAN) - -#else -#error "Unsupported compiler" -#endif + AT : (sizeof(AT)-sizeof(T))*8*(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) #endif