summaryrefslogtreecommitdiff
path: root/src/lxml/lxml_endian.h
blob: f53cb7ad7ae9b93cd4d7c32178661ae979253a3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef PY_BIG_ENDIAN

#ifdef _MSC_VER
typedef unsigned __int32 uint32_t;
#else
#include <stdint.h>
#endif

static CYTHON_INLINE int _lx__is_big_endian(void) {
    union {uint32_t i; char c[4];} x = {0x01020304};
    return x.c[0] == 1;
}
#define PY_BIG_ENDIAN _lx__is_big_endian()
#endif