Mercurial > minori
comparison include/core/endian.h @ 413:192da585a0a8 default tip
*: fix formatting
the clang-format file was broken andjust using LLVM defaults.
now it's fixed and is more in line with what I actually prefer my
code to look like -- esp. with regards to tabulators
| author | Paper <paper@tflc.us> |
|---|---|
| date | Sat, 25 Jul 2026 14:54:32 -0400 |
| parents | 47c9f8502269 |
| children |
comparison
equal
deleted
inserted
replaced
| 412:05aed03e0111 | 413:192da585a0a8 |
|---|---|
| 36 { | 36 { |
| 37 #ifdef COMPILER_BUILTIN_BSWAP32 | 37 #ifdef COMPILER_BUILTIN_BSWAP32 |
| 38 return COMPILER_BUILTIN_BSWAP32(x); | 38 return COMPILER_BUILTIN_BSWAP32(x); |
| 39 #else | 39 #else |
| 40 return (((x & UINT32_C(0x000000FF)) << 24) | ((x & UINT32_C(0x0000FF00)) << 8) | | 40 return (((x & UINT32_C(0x000000FF)) << 24) | ((x & UINT32_C(0x0000FF00)) << 8) | |
| 41 ((x & UINT32_C(0x00FF0000)) >> 8) | ((x & UINT32_C(0xFF000000)) >> 24)); | 41 ((x & UINT32_C(0x00FF0000)) >> 8) | ((x & UINT32_C(0xFF000000)) >> 24)); |
| 42 #endif | 42 #endif |
| 43 } | 43 } |
| 44 | 44 |
| 45 static constexpr uint64_t byteswap_64(uint64_t x) | 45 static constexpr uint64_t byteswap_64(uint64_t x) |
| 46 { | 46 { |
| 47 #ifdef COMPILER_BUILTIN_BSWAP64 | 47 #ifdef COMPILER_BUILTIN_BSWAP64 |
| 48 return COMPILER_BUILTIN_BSWAP64(x); | 48 return COMPILER_BUILTIN_BSWAP64(x); |
| 49 #else | 49 #else |
| 50 return (((x & UINT64_C(0x00000000000000FF)) << 56) | ((x & UINT64_C(0x000000000000FF00)) << 40) | | 50 return (((x & UINT64_C(0x00000000000000FF)) << 56) | ((x & UINT64_C(0x000000000000FF00)) << 40) | |
| 51 ((x & UINT64_C(0x0000000000FF0000)) << 24) | ((x & UINT64_C(0x00000000FF000000)) << 8) | | 51 ((x & UINT64_C(0x0000000000FF0000)) << 24) | ((x & UINT64_C(0x00000000FF000000)) << 8) | |
| 52 ((x & UINT64_C(0x000000FF00000000)) >> 8) | ((x & UINT64_C(0x0000FF0000000000)) >> 24) | | 52 ((x & UINT64_C(0x000000FF00000000)) >> 8) | ((x & UINT64_C(0x0000FF0000000000)) >> 24) | |
| 53 ((x & UINT64_C(0x00FF000000000000)) >> 40) | ((x & UINT64_C(0xFF00000000000000)) >> 56)); | 53 ((x & UINT64_C(0x00FF000000000000)) >> 40) | ((x & UINT64_C(0xFF00000000000000)) >> 56)); |
| 54 #endif | 54 #endif |
| 55 } | 55 } |
| 56 | 56 |
| 57 #ifdef COMPILER_BUILTIN_BSWAP16 | 57 #ifdef COMPILER_BUILTIN_BSWAP16 |
| 58 # undef COMPILER_BUILTIN_BSWAP16 | 58 # undef COMPILER_BUILTIN_BSWAP16 |
