8#ifndef INCLUDED_BDLC_FLATHASHTABLE_GROUPCONTROL
9#define INCLUDED_BDLC_FLATHASHTABLE_GROUPCONTROL
66#include <bdlscm_version.h>
72#include <bsl_cstddef.h>
73#include <bsl_cstdint.h>
74#include <bsl_cstring.h>
76#if defined(BSLS_PLATFORM_CPU_SSE2)
94#if defined(BSLS_PLATFORM_CPU_SSE2)
102 static const bsl::uint64_t k_MULT = 0x0101010101010101ull;
103 static const bsl::uint64_t k_DEFLATE = 0x0002040810204081ull;
104 static const int k_DEFLATE_SHIFT = 56;
105 static const bsl::uint64_t k_MSB_MASK = 0x8080808080808080ull;
115 bsl::uint32_t matchRaw(bsl::uint8_t value)
const;
147 bsl::uint32_t
inUse()
const;
152 bsl::uint32_t
match(bsl::uint8_t value)
const;
169bsl::uint32_t FlatHashTable_GroupControl::matchRaw(bsl::uint8_t value)
const
171#if defined(BSLS_PLATFORM_CPU_SSE2)
172 return _mm_movemask_epi8(_mm_cmpeq_epi8(
173 _mm_set1_epi8(
static_cast<char>(value)),
176 Storage t = d_value ^ (k_MULT * value);
182 return static_cast<bsl::uint32_t
>(
183 (((~t) & k_MSB_MASK) * k_DEFLATE) >> k_DEFLATE_SHIFT);
189FlatHashTable_GroupControl::FlatHashTable_GroupControl(
190 const bsl::uint8_t *data)
192#if defined(BSLS_PLATFORM_CPU_SSE2)
193 d_value = _mm_loadu_si128(
static_cast<const Storage *
>(
194 static_cast<const void *
>(data)));
196 bsl::memcpy(&d_value, data,
k_SIZE);
205#if defined(BSLS_PLATFORM_CPU_SSE2)
206 return _mm_movemask_epi8(d_value);
208 return static_cast<bsl::uint32_t
>(
209 ((d_value & k_MSB_MASK) * k_DEFLATE) >> k_DEFLATE_SHIFT);
216#if defined(BSLS_PLATFORM_CPU_SSE2)
228 return matchRaw(value);
Definition bdlc_flathashtable_groupcontrol.h:91
static const bsl::uint8_t k_EMPTY
Definition bdlc_flathashtable_groupcontrol.h:124
~FlatHashTable_GroupControl()=default
static const bsl::size_t k_SIZE
Definition bdlc_flathashtable_groupcontrol.h:126
static const bsl::uint8_t k_ERASED
Definition bdlc_flathashtable_groupcontrol.h:125
bsl::uint32_t match(bsl::uint8_t value) const
Definition bdlc_flathashtable_groupcontrol.h:224
bsl::uint32_t inUse() const
Definition bdlc_flathashtable_groupcontrol.h:214
bsl::uint32_t available() const
Definition bdlc_flathashtable_groupcontrol.h:203
bsl::uint64_t Storage
Definition bdlc_flathashtable_groupcontrol.h:97
bool neverFull() const
Definition bdlc_flathashtable_groupcontrol.h:232
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_BYTEORDER_HOST_U64_TO_LE(x)
Definition bsls_byteorder.h:366
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlc_bitarray.h:503