File tree Expand file tree Collapse file tree 3 files changed +2
-88
lines changed
rust_shadowing_helper_functions Expand file tree Collapse file tree 3 files changed +2
-88
lines changed Original file line number Diff line number Diff line change @@ -169,8 +169,7 @@ pub fn execute_bench_deprecated(
169
169
170
170
/// Execute a Triton-VM program and test correct behavior indicators.
171
171
/// Modify stack and memory. Panic if anything goes wrong.
172
- #[ allow( clippy:: too_many_arguments) ]
173
- pub fn execute_test (
172
+ pub ( crate ) fn execute_test (
174
173
code : & [ LabelledInstruction ] ,
175
174
stack : & mut Vec < BFieldElement > ,
176
175
expected_stack_diff : isize ,
@@ -254,7 +253,7 @@ pub fn maybe_write_debuggable_vm_state_to_disk(vm_state: &VMState) {
254
253
}
255
254
256
255
/// Prepare state and run Triton VM
257
- pub fn execute_with_terminal_state (
256
+ pub ( crate ) fn execute_with_terminal_state (
258
257
program : Program ,
259
258
std_in : & [ BFieldElement ] ,
260
259
stack : & [ BFieldElement ] ,
Original file line number Diff line number Diff line change 1
1
pub mod array;
2
2
pub mod claim;
3
3
pub mod dyn_malloc;
4
- pub mod input;
5
4
pub mod list;
6
-
7
- /// Count the number of non-leaf nodes that were inserted *prior* to
8
- /// the insertion of this leaf.
9
- pub fn non_leaf_nodes_left ( leaf_index : u64 ) -> u64 {
10
- // This formula is derived as follows:
11
- // To get the heights of peaks before this leaf index was inserted, bit-decompose
12
- // the number of leaves before it was inserted.
13
- // Number of leaves in tree of height h = 2^h
14
- // Number of nodes in tree of height h = 2^(h + 1) - 1
15
- // Number of non-leaves is `#(nodes) - #(leaves)`.
16
- // Thus: f(x) = sum_{h}(2^h - 1)
17
-
18
- // An upper limit for the loop iterator is the log_2_floor(leaf_index)
19
- let log_2_floor_plus_one = u64:: BITS - leaf_index. leading_zeros ( ) ;
20
- let mut h = 0 ;
21
- let mut ret = 0 ;
22
- while h != log_2_floor_plus_one {
23
- let pow = ( 1 << h) & leaf_index;
24
- if pow != 0 {
25
- ret += pow - 1 ;
26
- }
27
- h += 1 ;
28
- }
29
-
30
- ret
31
- }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments