diff options
| author | Theo Buehler <tb@openbsd.org> | 2026-07-14 12:02:55 +0200 |
|---|---|---|
| committer | Theo Buehler <tb@openbsd.org> | 2026-07-14 12:03:19 +0200 |
| commit | 8c68203f0f6069309b3069f7fc829d1bd9564802 (patch) | |
| tree | 010cd5b944a8db6636fbcc709664d81665a7cbb1 /include | |
| parent | 5613638d3217551171a5a67f3b5554b8ae055db9 (diff) | |
| parent | 341b07f0dd12b77aeafe4282144c9f8168f5f5bd (diff) | |
| download | portable-8c68203f0f6069309b3069f7fc829d1bd9564802.tar.gz portable-8c68203f0f6069309b3069f7fc829d1bd9564802.tar.bz2 portable-8c68203f0f6069309b3069f7fc829d1bd9564802.zip | |
Land #1320 - fix htole64 fallback on AIX
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 | ||
