[many] Fix many cases of 1 << n exceeding the size of int
Yet again burned by the fack that integer literals are assumed to be of type int, so `1 << n` is 0 for any n >= 32. This burned me in the frame allocator, but I also grepped for all instances of `1 <<` and fixed those too.
This commit is contained in:
@@ -84,7 +84,7 @@ public:
|
||||
m_nodes(nullptr)
|
||||
{
|
||||
if (capacity)
|
||||
set_capacity(1 << log2(capacity));
|
||||
set_capacity(1ull << log2(capacity));
|
||||
}
|
||||
|
||||
virtual ~base_map() {
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
m_nodes {nullptr}
|
||||
{
|
||||
if (capacity) {
|
||||
m_capacity = 1 << log2(capacity);
|
||||
m_capacity = 1ull << log2(capacity);
|
||||
m_nodes = reinterpret_cast<node_type*>(
|
||||
alloc::allocate(m_capacity * sizeof(node_type)));
|
||||
for (size_t i = 0; i < m_capacity; ++i)
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
void ensure_capacity(count_t size)
|
||||
{
|
||||
if (capacity() >= size) return;
|
||||
count_t capacity = (1 << log2(size));
|
||||
count_t capacity = (1ull << log2(size));
|
||||
if (capacity < min_capacity)
|
||||
capacity = min_capacity;
|
||||
set_capacity(capacity);
|
||||
|
||||
Reference in New Issue
Block a user