MCPcopy Create free account
hub / github.com/RenderKit/embree / CeilLog2

Function CeilLog2

tutorials/common/image/tinyexr.h:5561–5575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5559
5560
5561static int CeilLog2(unsigned x) {
5562 //
5563 // For x > 0, ceilLog2(y) returns ceil(log(x)/log(2)).
5564 //
5565 int y = 0;
5566 int r = 0;
5567 while (x > 1) {
5568 if (x & 1)
5569 r = 1;
5570
5571 y += 1;
5572 x >>= 1u;
5573 }
5574 return y + r;
5575}
5576
5577static int RoundLog2(int x, int tile_rounding_mode) {
5578 return (tile_rounding_mode == TINYEXR_TILE_ROUND_DOWN) ? FloorLog2(static_cast<unsigned>(x)) : CeilLog2(static_cast<unsigned>(x));

Callers 1

RoundLog2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected