lua-arc4random

Cryptographically secure PRNG for Lua
Log | Files | Refs | README

endian.h (720B)


      1 /*
      2  * Public domain
      3  * machine/endian.h compatibility shim
      4  */
      5 
      6 #ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
      7 #define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
      8 
      9 #if defined(_WIN32)
     10 
     11 #define LITTLE_ENDIAN  1234
     12 #define BIG_ENDIAN 4321
     13 #define PDP_ENDIAN	3412
     14 
     15 /*
     16  * Use GCC and Visual Studio compiler defines to determine endian.
     17  */
     18 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
     19 #define BYTE_ORDER LITTLE_ENDIAN
     20 #else
     21 #define BYTE_ORDER BIG_ENDIAN
     22 #endif
     23 
     24 #elif defined(__linux__)
     25 #include <endian.h>
     26 
     27 #elif defined(__sun) || defined(_AIX) || defined(__hpux)
     28 #include <sys/types.h>
     29 #include <arpa/nameser_compat.h>
     30 
     31 #elif defined(__sgi)
     32 #include <standards.h>
     33 #include <sys/endian.h>
     34 
     35 #else
     36 #include_next <machine/endian.h>
     37 
     38 #endif
     39 
     40 #endif