diff options
Diffstat (limited to 'src/bplist.c')
| -rw-r--r-- | src/bplist.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c index 77e6245..d03dc2b 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -133,6 +133,40 @@ static uint32_t uint24_from_be(union plist_uint_ptr buf) | |||
| 133 | return ret; | 133 | return ret; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | #ifndef be16toh | ||
| 137 | #if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN | ||
| 138 | #define be16toh(x) (x) | ||
| 139 | #else | ||
| 140 | #define be16toh(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) | ||
| 141 | #endif | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #ifndef be32toh | ||
| 145 | #if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN | ||
| 146 | #define be32toh(x) (x) | ||
| 147 | #else | ||
| 148 | #define be32toh(x) ((((x) & 0xFF000000) >> 24) \ | ||
| 149 | | (((x) & 0x00FF0000) >> 8) \ | ||
| 150 | | (((x) & 0x0000FF00) << 8) \ | ||
| 151 | | (((x) & 0x000000FF) << 24)) | ||
| 152 | #endif | ||
| 153 | #endif | ||
| 154 | |||
| 155 | #ifndef be64toh | ||
| 156 | #if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN | ||
| 157 | #define be64toh(x) (x) | ||
| 158 | #else | ||
| 159 | #define be64toh(x) ((((x) & 0xFF00000000000000ull) >> 56) \ | ||
| 160 | | (((x) & 0x00FF000000000000ull) >> 40) \ | ||
| 161 | | (((x) & 0x0000FF0000000000ull) >> 24) \ | ||
| 162 | | (((x) & 0x000000FF00000000ull) >> 8) \ | ||
| 163 | | (((x) & 0x00000000FF000000ull) << 8) \ | ||
| 164 | | (((x) & 0x0000000000FF0000ull) << 24) \ | ||
| 165 | | (((x) & 0x000000000000FF00ull) << 40) \ | ||
| 166 | | (((x) & 0x00000000000000FFull) << 56)) | ||
| 167 | #endif | ||
| 168 | #endif | ||
| 169 | |||
| 136 | #define UINT_TO_HOST(x, n) \ | 170 | #define UINT_TO_HOST(x, n) \ |
| 137 | ({ \ | 171 | ({ \ |
| 138 | union plist_uint_ptr __up; \ | 172 | union plist_uint_ptr __up; \ |
