diff options
| author | Kartik Naik <kartik@bugqore.com> | 2026-07-13 01:32:03 +0530 |
|---|---|---|
| committer | Kartik Naik <kartik@bugqore.com> | 2026-07-13 01:32:03 +0530 |
| commit | 341b07f0dd12b77aeafe4282144c9f8168f5f5bd (patch) | |
| tree | 41e352d0f7b899e063f21da89e1f582fe21b3d96 /include | |
| parent | 5d8cd43d9b733e5774c2646820632b38dfa0e9f2 (diff) | |
| download | portable-341b07f0dd12b77aeafe4282144c9f8168f5f5bd.tar.gz portable-341b07f0dd12b77aeafe4282144c9f8168f5f5bd.tar.bz2 portable-341b07f0dd12b77aeafe4282144c9f8168f5f5bd.zip | |
fix htole64 fallback byte order in AIX endian shim
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/endian.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/compat/endian.h b/include/compat/endian.h index 89c83fc..8022e0e 100644 --- a/include/compat/endian.h +++ b/include/compat/endian.h | |||
| @@ -182,15 +182,15 @@ static inline uint64_t htole64(uint64_t x) { | |||
| 182 | uint64_t u64; | 182 | uint64_t u64; |
| 183 | unsigned char bytes[8]; | 183 | unsigned char bytes[8]; |
| 184 | } val; | 184 | } val; |
| 185 | val.u64 = x; | 185 | val.bytes[0] = (unsigned char)x; |
| 186 | return ((uint64_t)val.bytes[0] << 56) | | 186 | val.bytes[1] = (unsigned char)(x >> 8); |
| 187 | ((uint64_t)val.bytes[1] << 48) | | 187 | val.bytes[2] = (unsigned char)(x >> 16); |
| 188 | ((uint64_t)val.bytes[2] << 40) | | 188 | val.bytes[3] = (unsigned char)(x >> 24); |
| 189 | ((uint64_t)val.bytes[3] << 32) | | 189 | val.bytes[4] = (unsigned char)(x >> 32); |
| 190 | ((uint64_t)val.bytes[4] << 24) | | 190 | val.bytes[5] = (unsigned char)(x >> 40); |
| 191 | ((uint64_t)val.bytes[5] << 16) | | 191 | val.bytes[6] = (unsigned char)(x >> 48); |
| 192 | ((uint64_t)val.bytes[6] << 8) | | 192 | val.bytes[7] = (unsigned char)(x >> 56); |
| 193 | (uint64_t)val.bytes[7]; | 193 | return val.u64; |
| 194 | #endif | 194 | #endif |
| 195 | } | 195 | } |
| 196 | 196 | ||
