feat: add no-std support

closes #5
This commit is contained in:
Victor Lopez
2022-11-22 13:35:27 +01:00
parent 7395697a68
commit 3b9d515d00
7 changed files with 60 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
use super::MerkleError;
use crate::{
hash::{merge, Digest},
log2, uninit_vector, Felt, FieldElement, Word,
log2, uninit_vector, Felt, FieldElement, Vec, Word,
};
use core::slice;
@@ -80,7 +80,7 @@ impl MerkleTree {
return Err(MerkleError::InvalidIndex(depth, index));
}
let pos = 2usize.pow(depth as u32) + (index as usize);
let pos = 2_usize.pow(depth) + (index as usize);
Ok(self.nodes[pos])
}
@@ -102,7 +102,7 @@ impl MerkleTree {
}
let mut path = Vec::with_capacity(depth as usize);
let mut pos = 2usize.pow(depth as u32) + (index as usize);
let mut pos = 2_usize.pow(depth) + (index as usize);
while pos > 1 {
path.push(self.nodes[pos ^ 1]);