Line | Count | Source |
1 | #include "zserio/BuiltInOperators.h" | |
2 | ||
3 | namespace zserio | |
4 | { | |
5 | ||
6 | namespace builtin | |
7 | { | |
8 | ||
9 | uint8_t numBits(uint64_t numValues) | |
10 | 28 | { |
11 | 28 | if (numValues == 0) |
12 | 1 | { |
13 | 1 | return 0; |
14 | 1 | } |
15 | ||
16 | 27 | uint8_t result = 1; |
17 | 27 | uint64_t current = (numValues - 1U) >> 1U; |
18 | 389 | while (current > 0) |
19 | 362 | { |
20 | 362 | result++; |
21 | 362 | current >>= 1U; |
22 | 362 | } |
23 | ||
24 | 27 | return result; |
25 | 28 | } |
26 | ||
27 | } // namespace builtin | |
28 | ||
29 | } // namespace zserio |