23 constexpr bool is_big_endian() {
return std::endian::native == std::endian::big; }
29 constexpr bool is_little_endian() {
return std::endian::native == std::endian::little; }
70#define MAL_TOOLKIT_DETAIL_ENDIANNES_ICC 0
71#define MAL_TOOLKIT_DETAIL_ENDIANNES_GCC 0
72#define MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC 0
73#if defined(__INTEL_COMPILER) || defined(__ICC)
75#define MAL_TOOLKIT_DETAIL_ENDIANNES_ICC 1
76#elif defined(__GNUC__)
78#define MAL_TOOLKIT_DETAIL_ENDIANNES_GCC 1
79#elif defined(_MSC_VER)
81#define MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC 1
118 return ((x & 0xFF00u) >> 8u) | ((x & 0x00FFu) << 8u);
120#if MAL_TOOLKIT_DETAIL_ENDIANNES_ICC
122#elif MAL_TOOLKIT_DETAIL_ENDIANNES_GCC
123 return __builtin_bswap16(x);
124#elif MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC
125 return _byteswap_ushort(x);
127 return ((x & 0xFF00u) >> 8u) | ((x & 0x00FFu) << 8u);
140 return ((x & 0xFF000000u) >> 24u) | ((x & 0x00FF0000u) >> 8u) | ((x & 0x0000FF00u) << 8u) |
141 ((x & 0x000000FFu) << 24u);
143#if MAL_TOOLKIT_DETAIL_ENDIANNES_ICC
145#elif MAL_TOOLKIT_DETAIL_ENDIANNES_GCC
146 return __builtin_bswap32(x);
147#elif MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC
148 return _byteswap_ulong(x);
150 return ((x & 0xFF000000u) >> 24u) | ((x & 0x00FF0000u) >> 8u) | ((x & 0x0000FF00u) << 8u) |
151 ((x & 0x000000FFu) << 24u);
164 return ((x & 0xFF00000000000000u) >> 56u) | ((x & 0x00FF000000000000u) >> 40u) |
165 ((x & 0x0000FF0000000000u) >> 24u) | ((x & 0x000000FF00000000u) >> 8u) |
166 ((x & 0x00000000FF000000u) << 8u) | ((x & 0x0000000000FF0000u) << 24u) |
167 ((x & 0x000000000000FF00u) << 40u) | ((x & 0x00000000000000FFu) << 56u);
169#if MAL_TOOLKIT_DETAIL_ENDIANNES_ICC
171#elif MAL_TOOLKIT_DETAIL_ENDIANNES_GCC
172 return __builtin_bswap64(x);
173#elif MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC
174 return _byteswap_uint64(x);
176 return ((x & 0xFF00000000000000u) >> 56u) | ((x & 0x00FF000000000000u) >> 40u) |
177 ((x & 0x0000FF0000000000u) >> 24u) | ((x & 0x000000FF00000000u) >> 8u) |
178 ((x & 0x00000000FF000000u) << 8u) | ((x & 0x0000000000FF0000u) << 24u) |
179 ((x & 0x000000000000FF00u) << 40u) | ((x & 0x00000000000000FFu) << 56u);
195 const __m128i shuffle = _mm_set_epi64x(0x0001020304050607, 0x08090a0b0c0d0e0f);
196 return _mm_shuffle_epi8(x, shuffle);
210 const __m256i shuffle =
211 _mm256_set_epi64x(0x0001020304050607, 0x08090a0b0c0d0e0f, 0x0001020304050607, 0x08090a0b0c0d0e0f);
212 return _mm256_shuffle_epi8(x, shuffle);
Precompiled header (PCH) file for common headers used across the library.