MCPcopy Create free account
hub / github.com/cosdata/cosdata / power_of_4_with_index

Function power_of_4_with_index

org/src/version_tree.rs:17–27  ·  view source on GitHub ↗
(x: u32)

Source from the content-addressed store, hash-verified

15];
16
17pub fn power_of_4_with_index(x: u32) -> Option<usize> {
18 // Check if the number is 0 (not a power of 4)
19 if x == 0 {
20 return None;
21 }
22 // Check if x is in the list of powers of 4 and return its index
23 match POWERS_OF_4.iter().position(|&power| power == x) {
24 Some(index) => Some(index),
25 None => None,
26 }
27}
28
29#[derive(Debug)]
30struct VersionNode {

Callers 1

insert_nodeMethod · 0.85

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected