Skip to content

Commit

Permalink
feat: avoid use of floats to add CosmWasm support (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgoergens authored Mar 14, 2023
1 parent 71118dc commit fa99c5d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ exclude = ["/ci/*", "/scripts/*", "/.github/*", "/bors.toml"]

[dependencies]
sha2 = { version = "0.10", default-features = false }
micromath = "2.0.0"

# standard crate data is left out
[dev-dependencies]
Expand Down
7 changes: 1 addition & 6 deletions src/utils/indices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ pub fn parent_indices(indices: &[usize]) -> Vec<usize> {
}

pub fn tree_depth(leaves_count: usize) -> usize {
if leaves_count == 1 {
1
} else {
let val = micromath::F32(leaves_count as f32);
val.log2().ceil().0 as usize
}
8 * core::mem::size_of::<usize>() - leaves_count.leading_zeros() as usize
}

pub fn uneven_layers(tree_leaves_count: usize) -> BTreeMap<usize, usize> {
Expand Down

0 comments on commit fa99c5d

Please sign in to comment.