changes
This commit is contained in:
12
src/main.rs
12
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 ff0<ff1 {
|
||||
ff0=wt_parent(ff0);
|
||||
println!("Setting self.tree[{}].weight to {}",ff0,self.tree[ff0].weight);
|
||||
self.tree[ff0].weight=w;
|
||||
self.tree[ff0].count=c;
|
||||
}
|
||||
@@ -294,11 +296,16 @@ impl RoyaltyTree {
|
||||
let mut index=index;
|
||||
let ff=self.forefather();
|
||||
while index!=ff {
|
||||
if self.tree[index].weight==FiNum::zero() && weight>FiNum::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;
|
||||
|
||||
Reference in New Issue
Block a user