Add macros to detect endianness
This commit is contained in:
parent
aae4909d30
commit
61f0182c3f
7
src/endianness.h
Normal file
7
src/endianness.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef ENDIANNESS_H
|
||||||
|
#define ENDIANNESS_H
|
||||||
|
|
||||||
|
#define IS_LITTLE_ENDIAN ((*(uint8_t *)(&(uint32_t){0x00010203})) == 0x03)
|
||||||
|
#define IS_BIG_ENDIAN ((*(uint8_t *)(&(uint32_t){0x00010203})) == 0x00)
|
||||||
|
|
||||||
|
#endif // !ENDIANNESS_H
|
Loading…
Reference in New Issue
Block a user