MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / CeilLog2

Function CeilLog2

Source/ThirdParty/tinyexr.h:7002–7016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7000
7001
7002static int CeilLog2(unsigned x) {
7003 //
7004 // For x > 0, ceilLog2(y) returns ceil(log(x)/log(2)).
7005 //
7006 int y = 0;
7007 int r = 0;
7008 while (x > 1) {
7009 if (x & 1)
7010 r = 1;
7011
7012 y += 1;
7013 x >>= 1u;
7014 }
7015 return y + r;
7016}
7017
7018static int RoundLog2(int x, int tile_rounding_mode) {
7019 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