mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
don't use exp2 when allocating memory :D
This commit is contained in:
parent
3e4fe88b26
commit
3bcc5604a6
|
@ -5,7 +5,14 @@
|
|||
namespace llarp {
|
||||
template <typename T>
|
||||
static constexpr size_t alignment() {
|
||||
return std::exp2(1 + std::floor(std::log2(sizeof(T))));
|
||||
size_t idx = 0;
|
||||
size_t sz = sizeof(T);
|
||||
while(sz)
|
||||
{
|
||||
++idx;
|
||||
sz >>= 1;
|
||||
}
|
||||
return 1 << idx;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Reference in a new issue