MCPcopy Create free account
hub / github.com/catboost/catboost / FirstNonZeroBit

Method FirstNonZeroBit

util/generic/bitmap.h:942–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940 }
941
942 size_t FirstNonZeroBit() const {
943 for (size_t i = 0; i < Mask.GetChunkCapacity(); ++i) {
944 if (Mask.Data[i]) {
945 // CountTrailingZeroBits() expects unsigned types not smaller than unsigned int. So, convert before calling
946 return BitsPerChunk * i + CountTrailingZeroBits(TIntType(Mask.Data[i]));
947 }
948 }
949 return Size();
950 }
951
952 // Returns position of the next non-zero bit, which offset is greater than specified pos
953 // Typical loop for iterating bits:

Callers 2

FindFirstMethod · 0.80
Y_UNIT_TESTFunction · 0.80

Calls 3

CountTrailingZeroBitsFunction · 0.85
SizeFunction · 0.50
GetChunkCapacityMethod · 0.45

Tested by

no test coverage detected