fix little endian vs big endian in the macros

This commit is contained in:
iceman1001 2021-06-22 07:49:17 +02:00
commit 88d9942d3f
3 changed files with 13 additions and 5 deletions

View file

@ -131,15 +131,21 @@ extern bool tearoff_enabled;
#endif
#endif
// convert 2 bytes to U16
// convert 2 bytes to U16 in little endian
#ifndef BYTES2UINT16
# define BYTES2UINT16(x) ((x[1] << 8) | (x[0]))
#endif
// convert 4 bytes to U32
// convert 4 bytes to U32 in little endian
#ifndef BYTES2UINT32
# define BYTES2UINT32(x) ((x[3] << 24) | (x[2] << 16) | (x[1] << 8) | (x[0]))
#endif
// convert 4 bytes to U32 in big endian
#ifndef BYTES2UINT32_BE
# define BYTES2UINT32_BE(x) ((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3]))
#endif
#define EVEN 0
#define ODD 1