Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions include/rigtorp/HashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ probing.
#pragma once

#include <algorithm>
#include <bit>
#include <cstddef>
#include <iterator>
#include <memory>
Expand Down Expand Up @@ -136,10 +137,7 @@ class HashMap {
HashMap(size_type bucket_count, key_type empty_key,
const allocator_type &alloc = allocator_type())
: empty_key_(empty_key), buckets_(alloc) {
size_t pow2 = 2;
while (pow2 < bucket_count) {
pow2 <<= 1;
}
size_t pow2 = std::bit_ceil(std::max<size_t>(bucket_count, 2));
buckets_.resize(pow2, std::make_pair(empty_key_, T()));
}

Expand Down
Loading