MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / next_pow2

Function next_pow2

nodedb-codec/src/vector_quant/rabitq.rs:56–62  ·  view source on GitHub ↗
(n: usize)

Source from the content-addressed store, hash-verified

54/// Next power-of-two ≥ `n`, returning `n` itself if already pow2.
55#[inline]
56fn next_pow2(n: usize) -> usize {
57 if n.is_power_of_two() {
58 n
59 } else {
60 n.next_power_of_two()
61 }
62}
63
64/// In-place Walsh-Hadamard Transform of a power-of-2 length slice.
65/// O(N log N) butterfly. Does not normalise by 1/√N (sign-only code

Callers 2

apply_rotationMethod · 0.85
encode_innerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected