MCPcopy Create free account
hub / github.com/pybind/pybind11 / log2

Function log2

include/pybind11/detail/common.h:609–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607PYBIND11_NAMESPACE_BEGIN(detail)
608
609static constexpr int log2(size_t n, int k = 0) { return (n <= 1) ? k : log2(n >> 1, k + 1); }
610
611// Returns the size as a multiple of sizeof(void *), rounded up.
612static constexpr size_t size_in_ptrs(size_t s) { return 1 + ((s - 1) >> log2(sizeof(void *))); }

Calls

no outgoing calls

Tested by

no test coverage detected