|
|
@ -560,8 +560,10 @@ struct signalfd_siginfo |
|
|
|
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory") |
|
|
|
#elif __sparc || __sparc__ |
|
|
|
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad | " : : : "memory") |
|
|
|
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") |
|
|
|
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") |
|
|
|
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") |
|
|
|
#elif defined(__s390__) || defined(__s390x__) |
|
|
|
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -856,25 +858,25 @@ ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << ( |
|
|
|
#define ecb_unreachable() __builtin_unreachable () |
|
|
|
#else |
|
|
|
/* this seems to work fine, but gcc always emits a warning for it :/ */ |
|
|
|
ecb_function_ void ecb_unreachable (void) ecb_noreturn; |
|
|
|
ecb_function_ void ecb_unreachable (void) { } |
|
|
|
ecb_inline void ecb_unreachable (void) ecb_noreturn; |
|
|
|
ecb_inline void ecb_unreachable (void) { } |
|
|
|
#endif |
|
|
|
|
|
|
|
/* try to tell the compiler that some condition is definitely true */ |
|
|
|
#define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) |
|
|
|
|
|
|
|
ecb_function_ unsigned char ecb_byteorder_helper (void) ecb_const; |
|
|
|
ecb_function_ unsigned char |
|
|
|
ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const; |
|
|
|
ecb_inline unsigned char |
|
|
|
ecb_byteorder_helper (void) |
|
|
|
{ |
|
|
|
const uint32_t u = 0x11223344; |
|
|
|
return *(unsigned char *)&u; |
|
|
|
} |
|
|
|
|
|
|
|
ecb_function_ ecb_bool ecb_big_endian (void) ecb_const; |
|
|
|
ecb_function_ ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; } |
|
|
|
ecb_function_ ecb_bool ecb_little_endian (void) ecb_const; |
|
|
|
ecb_function_ ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; } |
|
|
|
ecb_inline ecb_bool ecb_big_endian (void) ecb_const; |
|
|
|
ecb_inline ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; } |
|
|
|
ecb_inline ecb_bool ecb_little_endian (void) ecb_const; |
|
|
|
ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; } |
|
|
|
|
|
|
|
#if ECB_GCC_VERSION(3,0) || ECB_C99 |
|
|
|
#define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0)) |
|
|
|