uint##size BitCountRange##size(const uint##size* const bits, \
uint##size start, uint##size end) { \
if (end - start > absl::GetFlag(FLAGS_bitset_small_bitset_count)) { \
const int offset_start = BitOffset##size(start); \
const int pos_start = BitPos##size(start); \
const int offset_end = BitOffset##size(end); \
const int pos_end = BitPos##size(end); \
if (offset_end == offset_start) { \
return BitCount##size(bits[offset_start] & \
OneRange##size(pos_start, pos_end)); \
} else { \
uint##size bit_count = zero; \
bit_count += \
BitCount##size(bits[offset_start] & IntervalUp##size(pos_start)); \
for (int offset = offset_start + 1; offset < offset_end; ++offset) { \
bit_count += BitCount##size(bits[offset]); \
} \
bit_count += \
BitCount##size(bits[offset_end] & IntervalDown##size(pos_end)); \
return bit_count; \
} \
} else { \
uint##size bit_count = zero; \
for (uint##size i = start; i <= end; ++i) { \
bit_count += IsBitSet##size(bits, i); \
} \
return bit_count; \
} \
}