From d47b3f12a73f481a311bc99bf425d7d5c3d17cfd Mon Sep 17 00:00:00 2001 From: Teppy Date: Wed, 18 Sep 2024 20:11:38 -0400 Subject: [PATCH] changes --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 22b848a..6b5a64d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,6 +36,7 @@ // + #![allow(unsafe_code)] #![allow(unused_variables)] #![allow(dead_code)] @@ -285,6 +286,7 @@ impl RoyaltyTree { self.expand_to(ff1*2); while ff0FiNum::zero() { self.tree[index].count+=1; } + println!("self.tree[{}].weight={}",index,self.tree[index].weight); + if self.weight_here(index)==FiNum::zero() && weight>FiNum::zero() { + self.tree[index].count+=1; + } self.tree[index].weight+=weight; index=wt_parent(index); } - if self.tree[index].weight==FiNum::zero() && weight>FiNum::zero() { self.tree[index].count+=1; } + if self.weight_here(index)==FiNum::zero() && weight>FiNum::zero() { + self.tree[index].count+=1; + } self.tree[index].weight+=weight; } fn forefather(&self) -> usize { @@ -795,6 +802,7 @@ fn royalty_stuff() { let mut rng: StdRng=StdRng::seed_from_u64(13u64); let mut rt=RoyaltyTree::new(); rt.add_weight(4,FiNum::new_i32(1)); + rt.dump(); rt.add_weight(5,FiNum::new_i32(1)); rt.dump(); return;