Code clean up (#33417)
clean up Co-authored-by: HaoranYi <haoran.yi@solana.com>
This commit is contained in:
parent
746f69772a
commit
e088eb2be0
|
@ -542,7 +542,7 @@ impl<'a> AccountsHasher<'a> {
|
||||||
|
|
||||||
// This function is designed to allow hashes to be located in multiple, perhaps multiply deep vecs.
|
// This function is designed to allow hashes to be located in multiple, perhaps multiply deep vecs.
|
||||||
// The caller provides a function to return a slice from the source data.
|
// The caller provides a function to return a slice from the source data.
|
||||||
pub fn compute_merkle_root_from_slices<'b, F, T>(
|
fn compute_merkle_root_from_slices<'b, F, T>(
|
||||||
total_hashes: usize,
|
total_hashes: usize,
|
||||||
fanout: usize,
|
fanout: usize,
|
||||||
max_levels_per_pass: Option<usize>,
|
max_levels_per_pass: Option<usize>,
|
||||||
|
@ -706,7 +706,7 @@ impl<'a> AccountsHasher<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_merkle_root_from_slices_recurse(
|
fn compute_merkle_root_from_slices_recurse(
|
||||||
hashes: Vec<Hash>,
|
hashes: Vec<Hash>,
|
||||||
fanout: usize,
|
fanout: usize,
|
||||||
max_levels_per_pass: Option<usize>,
|
max_levels_per_pass: Option<usize>,
|
||||||
|
|
|
@ -476,10 +476,9 @@ impl<'b, T: Clone + Copy + PartialEq + std::fmt::Debug + 'static> Bucket<T> {
|
||||||
// pop one entry at a time to insert in the first free location we find
|
// pop one entry at a time to insert in the first free location we find
|
||||||
'outer: while let Some((ix_entry_raw, i)) = reverse_sorted_entries.pop() {
|
'outer: while let Some((ix_entry_raw, i)) = reverse_sorted_entries.pop() {
|
||||||
let (k, v) = &items[i];
|
let (k, v) = &items[i];
|
||||||
let ix_entry = ix_entry_raw % cap;
|
|
||||||
// search for an empty spot starting at `ix_entry`
|
// search for an empty spot starting at `ix_entry`
|
||||||
for search in 0..search_end {
|
for search in 0..search_end {
|
||||||
let ix_index = (ix_entry + search) % cap;
|
let ix_index = (ix_entry_raw + search) % cap;
|
||||||
let elem = IndexEntryPlaceInBucket::new(ix_index);
|
let elem = IndexEntryPlaceInBucket::new(ix_index);
|
||||||
if index.try_lock(ix_index) {
|
if index.try_lock(ix_index) {
|
||||||
*entries_created_on_disk += 1;
|
*entries_created_on_disk += 1;
|
||||||
|
|
Loading…
Reference in New Issue