diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-02-28 12:34:51 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-02-28 12:34:51 +1100 |
| commit | 57b794ede3cae1e7c21309869a2c617481a55acf (patch) | |
| tree | 5e6b08c4b45b68fddfe5cf6fe43bd539c42e2866 /src | |
| parent | e52f83bd50b8d08fb85ef4de9b2234b440840e4d (diff) | |
compare against 0 instead of -1 in hash map code
Diffstat (limited to 'src')
| -rw-r--r-- | src/hash_map.hh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hash_map.hh b/src/hash_map.hh index 19406bd1..dcf76d42 100644 --- a/src/hash_map.hh +++ b/src/hash_map.hh @@ -74,7 +74,7 @@ struct HashIndex auto target_slot = compute_slot(entry.hash); for (auto slot = target_slot; slot < m_entries.size(); ++slot) { - if (m_entries[slot].index == -1) + if (m_entries[slot].index < 0) { m_entries[slot] = entry; return; @@ -104,7 +104,7 @@ struct HashIndex // Recompact following entries for (auto next = slot+1; next < m_entries.size(); ++next) { - if (m_entries[next].index == -1 or + if (m_entries[next].index < 0 or compute_slot(m_entries[next].hash) == next) break; kak_assert(compute_slot(m_entries[next].hash) < next); @@ -224,7 +224,7 @@ struct HashMap for (auto slot = m_index.compute_slot(hash); slot < m_index.size(); ++slot) { auto& entry = m_index[slot]; - if (entry.index == -1) + if (entry.index < 0) return -1; if (entry.hash == hash and item_key(m_items[entry.index]) == key) return entry.index; |
