26 const __m256i mask = _mm256_set1_epi8(0x0F);
27 const __m256i add = _mm256_set1_epi8(0x06);
28 const __m256i alpha_mask = _mm256_set1_epi8(0x10);
29 const __m256i alpha_offset = _mm256_set1_epi8(0x57);
31 __m256i a = _mm256_castsi128_si256(x);
32 __m256i as = _mm256_srli_epi64(a, 4);
33 __m256i lo = _mm256_unpacklo_epi8(as, a);
34 __m128i hi = _mm256_castsi256_si128(_mm256_unpackhi_epi8(as, a));
35 __m256i c = _mm256_inserti128_si256(lo, hi, 1);
36 __m256i d = _mm256_and_si256(c, mask);
37 __m256i alpha = _mm256_slli_epi64(_mm256_and_si256(_mm256_add_epi8(d, add), alpha_mask), 3);
38 __m256i offset = _mm256_blendv_epi8(_mm256_slli_epi64(add, 3), alpha_offset, alpha);
39 __m256i res = _mm256_add_epi8(d, offset);
43 const __m256i dash_shuffle = _mm256_set_epi32(0x0b0a0908, 0x07060504, 0x80030201, 0x00808080, 0x0d0c800b,
44 0x0a090880, 0x07060504, 0x03020100);
46 _mm256_set_epi64x(0x0000000000000000ull, 0x2d000000002d0000ull, 0x00002d000000002d, 0x0000000000000000ull);
48 __m256i resd = _mm256_shuffle_epi8(res, dash_shuffle);
49 resd = _mm256_or_si256(resd, dash);
66 const __m256i dash_shuffle = _mm256_set_epi32(0x80808080, 0x0f0e0d0c, 0x0b0a0908, 0x06050403, 0x80800f0e,
67 0x0c0b0a09, 0x07060504, 0x03020100);
70 x = _mm256_shuffle_epi8(x, dash_shuffle);
75 const __m256i sub = _mm256_set1_epi8(0x2F);
76 const __m256i mask = _mm256_set1_epi8(0x20);
77 const __m256i alpha_offset = _mm256_set1_epi8(0x28);
78 const __m256i digits_offset = _mm256_set1_epi8(0x01);
79 const __m256i unweave = _mm256_set_epi32(0x0f0d0b09, 0x0e0c0a08, 0x07050301, 0x06040200, 0x0f0d0b09, 0x0e0c0a08,
80 0x07050301, 0x06040200);
81 const __m256i shift = _mm256_set_epi32(0x00000000, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0x00000004,
82 0x00000000, 0x00000004);
90 __m256i a = _mm256_sub_epi8(x, sub);
91 __m256i alpha = _mm256_slli_epi64(_mm256_and_si256(a, mask), 2);
92 __m256i sub_mask = _mm256_blendv_epi8(digits_offset, alpha_offset, alpha);
93 a = _mm256_sub_epi8(a, sub_mask);
94 a = _mm256_shuffle_epi8(a, unweave);
95 a = _mm256_sllv_epi32(a, shift);
96 a = _mm256_hadd_epi32(a, _mm256_setzero_si256());
97 a = _mm256_permute4x64_epi64(a, 0b00001000);
99 return _mm256_castsi256_si128(a);
115 __m128i x = _mm_load_si128((__m128i *)other.
data);
116 _mm_store_si128((__m128i *)
data, x);
129 __m128i z = _mm_set_epi64x(x, y);
130 _mm_store_si128((__m128i *)
data, z);
138 __m128i x = _mm_loadu_si128((__m128i *)
bytes);
139 _mm_store_si128((__m128i *)
data, x);
148 _mm_store_si128((__m128i *)
data, x);
169 __m128i x = _mm_load_si128((__m128i *)other.
data);
170 _mm_store_si128((__m128i *)
data, x);
179 __m128i x = _mm_load_si128((__m128i *)lhs.
data);
180 __m128i y = _mm_load_si128((__m128i *)rhs.
data);
182 __m128i neq = _mm_xor_si128(x, y);
183 return _mm_test_all_zeros(neq, neq);
193 uint64_t *x = (uint64_t *)lhs.
data;
194 uint64_t *y = (uint64_t *)rhs.
data;
195 return *x < *y || (*x == *y && *(x + 1) < *(y + 1));
215 out.resize(
sizeof(
data));
216 bytes((
char *)out.data());
222 _mm_storeu_si128((__m128i *)
bytes, x);
235 void str(std::string &s)
const
238 str((
char *)s.data());
243 __m128i x = _mm_load_si128((__m128i *)
data);
257 size_t hash()
const {
return *((uint64_t *)
data) ^ *((uint64_t *)
data + 8); }
268 template <
typename RNG>
277 distribution(
std::numeric_limits<uint64_t>::min(),
std::numeric_limits<uint64_t>::max())
286 distribution(
std::numeric_limits<uint64_t>::min(),
std::numeric_limits<uint64_t>::max())
304 const __m128i and_mask = _mm_set_epi64x(0xFFFFFFFFFFFFFF3Full, 0xFF0FFFFFFFFFFFFFull);
305 const __m128i or_mask = _mm_set_epi64x(0x0000000000000080ull, 0x0040000000000000ull);
307 __m128i
uuid = _mm_or_si128(_mm_and_si128(n, and_mask), or_mask);
Provides functions and utilities for handling endianness conversions.
Provides utilities for working with Universally Unique Identifiers (UUIDs).