-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The following static assertion triggers even when it shouldn't because it is evaluated even when the alternate bucket selection method isn't TABLE_BASED_OFFSET, causing Morton1_8 to fail to compile (it uses FUNCTION_BASED_OFFSET, and the assertion shouldn't trigger).
morton_filter/compressed_cuckoo_filter.h
Lines 397 to 398 in cb7b788
| static_assert(offsets[0] > _buckets_per_block, | |
| "Cannot use TABLE_BASED_OFFSET with so many buckets per block"); |
context:
morton_filter/compressed_cuckoo_filter.h
Lines 391 to 412 in cb7b788
| switch(_alternate_bucket_selection_method){ | |
| case AlternateBucketSelectionMethodEnum::TABLE_BASED_OFFSET:{ | |
| constexpr int16_t offsets[] = {83, 149, 211, 277, 337, 397, 457, 521, | |
| 587, 653, 719, 787, 853, 919, 983, 1051, 1117, 1181, 1249, 1319, 1399, | |
| 1459, | |
| 1511, 1571, 1637, 1699, 1759, 1823, 1889, 1951, 2017, 1579};//, 1579 | |
| static_assert(offsets[0] > _buckets_per_block, | |
| "Cannot use TABLE_BASED_OFFSET with so many buckets per block"); | |
| offset = offsets[fingerprint % (sizeof(offsets) / sizeof(offsets[0]))]; | |
| break; | |
| } | |
| case AlternateBucketSelectionMethodEnum::FUNCTION_BASED_OFFSET:{ | |
| offset = ((raw_primary_hash(fingerprint) & 0x1fff) + | |
| (_buckets_per_block)) | one; | |
| break; | |
| } | |
| case AlternateBucketSelectionMethodEnum::FAN_ET_AL_PARTIAL_KEY: | |
| return fan_et_al_partial_key_cuckoo_hash_alternate_bucket(bucket_id, | |
| fingerprint); | |
| break; | |
| } |
Since _alternate_bucket_selection_method is known at compile time, the inverse of the case taken should be added to the assertion, something like this:
static_assert(offsets[0] > _buckets_per_block ||
_alternate_bucket_selection_method != AlternateBucketSelectionMethodEnum::TABLE_BASED_OFFSET,
"Cannot use TABLE_BASED_OFFSET with so many buckets per block");Metadata
Metadata
Assignees
Labels
No labels