MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / powerOf2

Function powerOf2

extra/yassl/taocrypt/test/memory.cpp:267–282  ·  view source on GitHub ↗

return power of 2 up to size_tracker elements

Source from the content-addressed store, hash-verified

265
266// return power of 2 up to size_tracker elements
267size_t powerOf2(size_t sz)
268{
269 size_t shifts = 0;
270
271 if (sz)
272 sz -= 1;
273 else
274 return 0;
275
276 while (sz) {
277 sz >>= 1;
278 ++shifts;
279 }
280
281 return shifts < size_elements ? shifts : size_elements;
282}
283
284
285} // namespace local

Callers 1

operator newFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected