Lines 6-11
Link Here
|
6 |
#include <unistd.h> |
6 |
#include <unistd.h> |
7 |
#endif |
7 |
#endif |
8 |
|
8 |
|
|
|
9 |
#include <endian.h> |
10 |
|
9 |
#define SETALIGNMENT |
11 |
#define SETALIGNMENT |
10 |
#include "base/all/packprag.h" |
12 |
#include "base/all/packprag.h" |
11 |
|
13 |
|
Lines 61-67
Link Here
|
61 |
#define put_unaligned(ptr, val) ((void)( *(ptr) = (val) )) |
63 |
#define put_unaligned(ptr, val) ((void)( *(ptr) = (val) )) |
62 |
#endif /* __EMULATE_UNALIGNED__ */ |
64 |
#endif /* __EMULATE_UNALIGNED__ */ |
63 |
|
65 |
|
64 |
#ifdef __BIG_ENDIAN__ |
66 |
#if BYTE_ORDER == BIG_ENDIAN |
65 |
#define ADJUST_ENDIANNESS16(Ptr) {\ |
67 |
#define ADJUST_ENDIANNESS16(Ptr) {\ |
66 |
USHORT x = get_unaligned((USHORT*) (Ptr));\ |
68 |
USHORT x = get_unaligned((USHORT*) (Ptr));\ |
67 |
put_unaligned((USHORT*) (Ptr), x >> 8 | x << 8);\ |
69 |
put_unaligned((USHORT*) (Ptr), x >> 8 | x << 8);\ |
Lines 78-87
Link Here
|
78 |
x2 = x2 >> 16 | x2 << 16;\ |
80 |
x2 = x2 >> 16 | x2 << 16;\ |
79 |
put_unaligned(((ULONG*) (Ptr)), (x2&0xff00ff00) >> 8 | (x2&0x00ff00ff) << 8);\ |
81 |
put_unaligned(((ULONG*) (Ptr)), (x2&0xff00ff00) >> 8 | (x2&0x00ff00ff) << 8);\ |
80 |
} |
82 |
} |
81 |
#else |
83 |
#elif BYTE_ORDER == LITTLE_ENDIAN |
82 |
#define ADJUST_ENDIANNESS16(Ptr) |
84 |
#define ADJUST_ENDIANNESS16(Ptr) |
83 |
#define ADJUST_ENDIANNESS32(Ptr) |
85 |
#define ADJUST_ENDIANNESS32(Ptr) |
84 |
#define ADJUST_ENDIANNESS64(Ptr) |
86 |
#define ADJUST_ENDIANNESS64(Ptr) |
|
|
87 |
#else |
88 |
#error Please define system endianness |
85 |
#endif |
89 |
#endif |
86 |
|
90 |
|
87 |
#endif |
91 |
#endif |