MCPcopy Create free account
hub / github.com/Snapchat/Valdi / initializeBitsets

Method initializeBitsets

valdi_core/src/valdi_core/cpp/Text/CharacterSet.cpp:79–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void CharacterSet::initializeBitsets(
80 const CharacterRange* ranges, size_t length, uint32_t minOffset, uint16_t* offsets, CharacterSet::Bitset* bitsets) {
81 processCharacters(ranges, length, [&](uint32_t offsetIndex, uint32_t bitsetsCount, uint32_t offsetValue) {
82 offsets[offsetIndex - minOffset] = bitsetsCount;
83
84 auto& bitset = bitsets[bitsetsCount];
85
86 auto indexInBitset = offsetValue >> kBitsetShift;
87 auto valueInBitset = 1 << (offsetValue & kBitsetMask);
88
89 bitset[indexInBitset] |= valueInBitset;
90 });
91}
92
93static bool needsSort(const CharacterRange* ranges, size_t length) {
94 for (size_t i = 1; i < length; i++) {

Callers

nothing calls this directly

Calls 1

processCharactersFunction · 0.85

Tested by

no test coverage detected