memgraph/include/utils/numerics/log2.hpp
Marko Budiselic 6355dd4f4d PtrInt data structure (Pointer Integer pair inside one pointer location). Part of T150
Summary: PtrInt data structure (Pointer Integer pair inside one pointer location). Part of T150

Test Plan: manual

Reviewers: sale

Subscribers: buda, sale

Differential Revision: https://memgraph.phacility.com/D11
2016-11-30 17:21:22 +01:00

11 lines
133 B
C++

#pragma once
#include <cstddef>
namespace utils
{
constexpr size_t log2(size_t n) { return ((n < 2) ? 0 : 1 + log2(n >> 1)); }
}