gcc fixes

This commit is contained in:
2024-02-03 13:16:13 -08:00
parent 584f2d0c54
commit a632d0cbbb

View File

@@ -176,11 +176,11 @@ int getNodeIndex(Node16 *self, uint8_t index) {
// Build a mask to select only the first node->num_children values from the
// comparison (because the other values are meaningless)
int mask = (1 << self->numChildren) - 1;
uint32_t mask = (1 << self->numChildren) - 1;
// Change the results of the comparison into a bitfield, masking off any
// invalid comparisons.
int bitfield = _mm_movemask_epi8(results) & mask;
uint32_t bitfield = _mm_movemask_epi8(results) & mask;
// No match if there are no '1's in the bitfield.
if (bitfield == 0)
@@ -260,7 +260,7 @@ int getChildGeq(Node *self, int child) {
memcpy(&indices, self16->index, sizeof(self16->index));
__m128i results = _mm_cmpeq_epi8(key_vec, _mm_min_epu8(key_vec, indices));
int mask = (1 << self16->numChildren) - 1;
int bitfield = _mm_movemask_epi8(results) & mask;
uint32_t bitfield = _mm_movemask_epi8(results) & mask;
int result = bitfield == 0 ? -1 : self16->index[std::countr_zero(bitfield)];
assert(result == [&]() -> int {
for (int i = 0; i < self16->numChildren; ++i) {
@@ -338,7 +338,7 @@ int getChildLeq(Node *self, int child) {
memcpy(&indices, self16->index, sizeof(self16->index));
__m128i results = _mm_cmpeq_epi8(key_vec, _mm_max_epu8(key_vec, indices));
int mask = (1 << self16->numChildren) - 1;
int bitfield = _mm_movemask_epi8(results) & mask;
uint32_t bitfield = _mm_movemask_epi8(results) & mask;
int result =
bitfield == 0 ? -1 : self16->index[31 - std::countl_zero(bitfield)];
assert(result == [&]() -> int {