MCPcopy Create free account
hub / github.com/a2flo/floor / encode_bit

Method encode_bit

src/core/bcm.cpp:73–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected