Zserio C++ runtime library  1.0.2
Built for Zserio 2.14.1
BuiltInOperators.cpp
Go to the documentation of this file.
2 
3 namespace zserio
4 {
5 
6 namespace builtin
7 {
8 
9 uint8_t numBits(uint64_t numValues)
10 {
11  if (numValues == 0)
12  {
13  return 0;
14  }
15 
16  uint8_t result = 1;
17  uint64_t current = (numValues - 1U) >> 1U;
18  while (current > 0)
19  {
20  result++;
21  current >>= 1U;
22  }
23 
24  return result;
25 }
26 
27 } // namespace builtin
28 
29 } // namespace zserio
uint8_t numBits(uint64_t numValues)