mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Dict: use std::log2, remove custom Log2 method
This commit is contained in:
parent
7e65b285ea
commit
25a280d6a1
1 changed files with 2 additions and 9 deletions
11
src/Dict.h
11
src/Dict.h
|
@ -3,6 +3,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -456,7 +457,7 @@ public:
|
||||||
{
|
{
|
||||||
// If an initial size is speicified, init the table right away. Otherwise wait until the
|
// If an initial size is speicified, init the table right away. Otherwise wait until the
|
||||||
// first insertion to init.
|
// first insertion to init.
|
||||||
log2_buckets = Log2(initial_size);
|
log2_buckets = static_cast<unsigned char>(std::log2(initial_size));
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,14 +942,6 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// bucket math
|
// bucket math
|
||||||
int Log2(int num) const
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while ( num >>= 1 )
|
|
||||||
i++;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ThresholdEntries() const
|
int ThresholdEntries() const
|
||||||
{
|
{
|
||||||
// Increase the size of the dictionary when it is 75% full. However, when the dictionary
|
// Increase the size of the dictionary when it is 75% full. However, when the dictionary
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue