BLI: assert that hash of key is the same after inserting it in hash table
These asserts would have caught the issue fixed in the previous commit earlier.
This commit is contained in:
parent
262c67d36b
commit
e299c41312
|
@ -1094,6 +1094,7 @@ class Map {
|
|||
MAP_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash, std::forward<ForwardValue>(value)...);
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return;
|
||||
}
|
||||
|
@ -1109,6 +1110,7 @@ class Map {
|
|||
MAP_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash, std::forward<ForwardValue>(value)...);
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return true;
|
||||
}
|
||||
|
@ -1164,6 +1166,7 @@ class Map {
|
|||
MAP_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash, create_value());
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return *slot.value();
|
||||
}
|
||||
|
@ -1182,6 +1185,7 @@ class Map {
|
|||
MAP_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash, std::forward<ForwardValue>(value)...);
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return *slot.value();
|
||||
}
|
||||
|
|
|
@ -787,6 +787,7 @@ class Set {
|
|||
SET_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash);
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return;
|
||||
}
|
||||
|
@ -801,6 +802,7 @@ class Set {
|
|||
SET_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash);
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return true;
|
||||
}
|
||||
|
@ -852,6 +854,7 @@ class Set {
|
|||
}
|
||||
if (slot.is_empty()) {
|
||||
slot.occupy(std::forward<ForwardKey>(key), hash);
|
||||
BLI_assert(hash_(*slot.key()) == hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return *slot.key();
|
||||
}
|
||||
|
|
|
@ -689,7 +689,9 @@ class VectorSet {
|
|||
VECTOR_SET_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
int64_t index = this->size();
|
||||
new (keys_ + index) Key(std::forward<ForwardKey>(key));
|
||||
Key *dst = keys_ + index;
|
||||
new (dst) Key(std::forward<ForwardKey>(key));
|
||||
BLI_assert(hash_(*dst) == hash);
|
||||
slot.occupy(index, hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return;
|
||||
|
@ -705,7 +707,9 @@ class VectorSet {
|
|||
VECTOR_SET_SLOT_PROBING_BEGIN (hash, slot) {
|
||||
if (slot.is_empty()) {
|
||||
int64_t index = this->size();
|
||||
new (keys_ + index) Key(std::forward<ForwardKey>(key));
|
||||
Key *dst = keys_ + index;
|
||||
new (dst) Key(std::forward<ForwardKey>(key));
|
||||
BLI_assert(hash_(*dst) == hash);
|
||||
slot.occupy(index, hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return true;
|
||||
|
@ -755,7 +759,9 @@ class VectorSet {
|
|||
}
|
||||
if (slot.is_empty()) {
|
||||
const int64_t index = this->size();
|
||||
new (keys_ + index) Key(std::forward<ForwardKey>(key));
|
||||
Key *dst = keys_ + index;
|
||||
new (dst) Key(std::forward<ForwardKey>(key));
|
||||
BLI_assert(hash_(*dst) == hash);
|
||||
slot.occupy(index, hash);
|
||||
occupied_and_removed_slots_++;
|
||||
return index;
|
||||
|
|
Loading…
Reference in New Issue