35 p ^ (-((b >> 31) & 1) & a),
36 (a >> 1) ^ (-(a & 1) & m),
51 template <
size_t i, u
int32_t m>
52 struct gf_powers_memo {
57 struct gf_powers_memo<0,
m> {
62 struct gf_powers_make {
63 template <
size_t...
i>
64 constexpr
auto operator()(index_sequence<i...>)
const {
71 #if FOLLY_SSE_PREREQ(4, 2) 78 const auto crc1_xmm = _mm_set_epi64x(0, crc1);
79 const auto crc2_xmm = _mm_set_epi64x(0, crc2);
80 const auto count = _mm_set_epi64x(0, 1);
81 const auto res0 = _mm_clmulepi64_si128(crc2_xmm, crc1_xmm, 0x00);
82 const auto res1 = _mm_sll_epi64(res0,
count);
85 const auto res2 = _mm_cvtsi128_si64(res1);
86 const auto res3 = _mm_crc32_u32(0, res2);
87 const auto res4 = _mm_extract_epi32(res1, 1);
92 const auto crc1_xmm = _mm_set_epi64x(0, crc1);
93 const auto crc2_xmm = _mm_set_epi64x(0, crc2);
94 const auto count = _mm_set_epi64x(0, 1);
95 const auto res0 = _mm_clmulepi64_si128(crc2_xmm, crc1_xmm, 0x00);
96 const auto res1 = _mm_sll_epi64(res0,
count);
99 const auto mask32 = _mm_set_epi32(0, 0, 0, 0xFFFFFFFF);
100 const auto barrett_reduction_constants =
101 _mm_set_epi32(0x1, 0xDB710641, 0x1, 0xF7011641);
102 const auto res2 = _mm_clmulepi64_si128(
103 _mm_and_si128(res1, mask32), barrett_reduction_constants, 0x00);
104 const auto res3 = _mm_clmulepi64_si128(
105 _mm_and_si128(res2, mask32), barrett_reduction_constants, 0x10);
106 return _mm_cvtsi128_si32(_mm_srli_si128(_mm_xor_si128(res3, res1), 4));
131 template <
typename F>
137 std::array<uint32_t, 62>
const& powers_array) {
138 auto powers = powers_array.data();
150 crc = mult(crc, *powers, polynomial);
static constexpr uint32_t gf_multiply_sw_1(size_t i, uint32_t p, uint32_t a, uint32_t b, uint32_t m)
BitIterator< BaseIter > findFirstSet(BitIterator< BaseIter >, BitIterator< BaseIter >)
static constexpr uint32_t crc32_m
uint32_t crc32_combine_hw(uint32_t crc1, uint32_t crc2, size_t crc2len)
—— Concurrent Priority Queue Implementation ——
static constexpr std::array< uint32_t, 62 > const crc32_powers
uint32_t crc32c_combine_hw(uint32_t crc1, uint32_t crc2, size_t crc2len)
uint32_t crc32_combine_sw(uint32_t crc1, uint32_t crc2, size_t crc2len)
uint32_t crc32c_combine_sw(uint32_t crc1, uint32_t crc2, size_t crc2len)
make_integer_sequence< std::size_t, Size > make_index_sequence
static map< string, int > m
static uint32_t crc32_append_zeroes(F mult, uint32_t crc, size_t len, uint32_t polynomial, std::array< uint32_t, 62 > const &powers_array)
static constexpr uint32_t crc32c_m
static uint32_t gf_multiply_crc32c_hw(uint64_t, uint64_t, uint32_t)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
static constexpr uint32_t gf_multiply_sw(uint32_t a, uint32_t b, uint32_t m)
static constexpr uint32_t value
static constexpr uint32_t gf_square_sw(uint32_t a, uint32_t m)
static constexpr std::array< uint32_t, 62 > const crc32c_powers
static uint32_t gf_multiply_crc32_hw(uint64_t, uint64_t, uint32_t)