Skip to content
Snippets Groups Projects
Commit beb8c6aa authored by Avi Kivity's avatar Avi Kivity
Browse files

Add function for compiling base-2 log at compile time

parent 9f215f69
No related branches found
No related tags found
No related merge requests found
ilog2.hh 0 → 100644
#ifndef OSV_ILOG2_HH
#define OSV_ILOG2_HH
#include <cstdint>
constexpr unsigned ilog2_roundup_constexpr(std::uintmax_t n)
{
return n <= 1 ? 0 : 1 + ilog2_roundup_constexpr((n >> 1) + (n & 1));
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment