| 71 | } |
| 72 | |
| 73 | template <uint32_t P_LOG> void encode_bit(const uint32_t mask, const uint32_t p, uint32_t& out_idx) { |
| 74 | const auto mid = uint32_t(low + ((uint64_t(high - low) * p) >> P_LOG)); |
| 75 | if (mask) { |
| 76 | high = mid; |
| 77 | } else { |
| 78 | low = mid + 1; |
| 79 | } |
| 80 | |
| 81 | // renormalize |
| 82 | while ((low ^ high) < (1u << 24u)) { |
| 83 | output[out_idx++] = uint8_t(low >> 24u); |
| 84 | low <<= 8u; |
| 85 | high = (high << 8u) + 255u; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | void put32(const uint32_t x) { |
| 90 | uint32_t out_idx = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected