Add byteswapping macros for big-endian systems

This commit is contained in:
Cameron Gutman
2021-04-17 21:43:13 -05:00
parent efaeade7a6
commit 4304e597d8
8 changed files with 146 additions and 92 deletions

View File

@@ -5,18 +5,6 @@
#define BYTE_ORDER_LITTLE 1
#define BYTE_ORDER_BIG 2
#ifndef HTONLL
#define HTONLL(x) \
((((x) & 0xff00000000000000ull) >> 56) \
| (((x) & 0x00ff000000000000ull) >> 40) \
| (((x) & 0x0000ff0000000000ull) >> 24) \
| (((x) & 0x000000ff00000000ull) >> 8) \
| (((x) & 0x00000000ff000000ull) << 8) \
| (((x) & 0x0000000000ff0000ull) << 24) \
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56))
#endif
typedef struct _BYTE_BUFFER {
char* buffer;
unsigned int length;