Sha256: f0bc6c298fec43802d8e061ab0360c2477b1be516cd9e8638fa0374c1e0f8ed3
Contents?: true
Size: 914 Bytes
Versions: 6
Compression:
Stored size: 914 Bytes
Contents
/** ** @file mruby/endian.h - detect endian-ness ** ** See Copyright Notice in mruby.h */ #ifndef MRUBY_ENDIAN_H #define MRUBY_ENDIAN_H #include <limits.h> MRB_BEGIN_DECL #if !defined(BYTE_ORDER) && defined(__BYTE_ORDER__) # define BYTE_ORDER __BYTE_ORDER__ #endif #if !defined(BIG_ENDIAN) && defined(__ORDER_BIG_ENDIAN__) # define BIG_ENDIAN __ORDER_BIG_ENDIAN__ #endif #if !defined(LITTLE_ENDIAN) && defined(__ORDER_LITTLE_ENDIAN__) # define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ #endif #ifdef BYTE_ORDER # if BYTE_ORDER == BIG_ENDIAN # define littleendian 0 # elif BYTE_ORDER == LITTLE_ENDIAN # define littleendian 1 # endif #endif #ifndef littleendian /* can't distinguish endian in compile time */ static inline int check_little_endian(void) { unsigned int n = 1; return (*(unsigned char *)&n == 1); } # define littleendian check_little_endian() #endif MRB_END_DECL #endif /* MRUBY_ENDIAN_H */
Version data entries
6 entries across 6 versions & 2 rubygems