@@ -377,15 +377,15 @@ impl K2Tree {
377
377
/* If no more leaves, then remove all stems immediately
378
378
and don't bother with complex stuff below */
379
379
self . stems = bitvec ! [ 0 ; stem_len] ;
380
- self . slayer_starts = vec ! [ 0 ] ;
380
+ self . slayer_starts = vec ! [ 0 ] ; //DEAD
381
381
return Ok ( ( ) )
382
382
}
383
383
self . stems . set ( stem_bit_pos, false ) ; //Dead leaf parent bit = 0
384
384
let mut curr_layer = self . max_slayers -1 ;
385
385
let mut stem_start = self . stem_start ( stem_bit_pos) ;
386
386
while curr_layer > 0
387
387
&& all_zeroes ( & self . stems , stem_start, stem_start+stem_len) {
388
- for layer_start in & mut self . slayer_starts [ curr_layer+1 ..] {
388
+ for layer_start in & mut self . slayer_starts [ curr_layer+1 ..] { //DEAD
389
389
// NOTE: this was 1 but it looks like that was an uncaught error, changed to stem_len
390
390
// if any errors, look here.
391
391
* layer_start -= stem_len; //Adjust lower layer start positions to reflect removal of stem
@@ -416,6 +416,7 @@ impl K2Tree {
416
416
- Construct leaf corresponding to range containing (x, y)
417
417
- Set bit at (x, y) to 1 */
418
418
//Either 0 or == max_slayers?
419
+ //ALIVE
419
420
let mut layer_starts_len = self . slayer_starts . len ( ) ; //cannot replace with max_slayers bc might not be max?
420
421
let mut layer = self . layer_from_range ( stem_range) ;
421
422
let mut subranges: SubRanges ;
@@ -452,7 +453,7 @@ impl K2Tree {
452
453
in the child layer. */
453
454
if layer == layer_starts_len-1 {
454
455
stem_start = self . stems . len ( ) ;
455
- self . slayer_starts . push ( stem_start) ;
456
+ self . slayer_starts . push ( stem_start) ; //ALIVE
456
457
layer_starts_len += 1 ;
457
458
}
458
459
else {
@@ -481,7 +482,7 @@ impl K2Tree {
481
482
/* If there are layers after the one we just insert a stem
482
483
into: Increase the layer_starts to account for
483
484
the extra stem */
484
- for layer_start in & mut self . slayer_starts [ layer+1 ..] {
485
+ for layer_start in & mut self . slayer_starts [ layer+1 ..] { //DEAD
485
486
* layer_start += stem_len;
486
487
}
487
488
}
@@ -611,10 +612,10 @@ impl K2Tree {
611
612
if self . leaves . len ( ) > 0 {
612
613
/* Only insert the extra layers etc. if the
613
614
tree isn't all 0s */
614
- for slayer_start in & mut self . slayer_starts {
615
+ for slayer_start in & mut self . slayer_starts { //DEAD
615
616
* slayer_start += stem_len;
616
617
}
617
- self . slayer_starts . insert ( 0 , 0 ) ;
618
+ self . slayer_starts . insert ( 0 , 0 ) ; //DEAD
618
619
/* Insert 10...00 to beginning of stems */
619
620
for _ in 0 ..stem_len-1 { self . stems . insert ( 0 , false ) ; }
620
621
self . stems . insert ( 0 , true ) ;
@@ -670,8 +671,8 @@ impl K2Tree {
670
671
} )
671
672
}
672
673
self . max_slayers -= 1 ;
673
- self . slayer_starts . remove ( 0 ) ;
674
- for slayer_start in & mut self . slayer_starts {
674
+ self . slayer_starts . remove ( 0 ) ; //DEAD
675
+ for slayer_start in & mut self . slayer_starts { //DEAD
675
676
* slayer_start -= stem_len;
676
677
}
677
678
/* Remove top layer stem */
@@ -698,8 +699,8 @@ impl K2Tree {
698
699
pub unsafe fn shrink_unchecked ( & mut self ) {
699
700
let stem_len = self . stem_len ( ) ;
700
701
self . max_slayers -= 1 ;
701
- self . slayer_starts . remove ( 0 ) ;
702
- for slayer_start in & mut self . slayer_starts {
702
+ self . slayer_starts . remove ( 0 ) ; //DEAD
703
+ for slayer_start in & mut self . slayer_starts { //DEAD
703
704
* slayer_start -= stem_len;
704
705
}
705
706
/* Remove top layer stem */
@@ -924,7 +925,7 @@ impl K2Tree {
924
925
else {
925
926
let nth_leaf = ones_in_range (
926
927
& self . stems ,
927
- self . slayer_starts [ self . max_slayers -1 ] ,
928
+ self . layer_start ( self . max_slayers -1 ) ,
928
929
stem_bitpos
929
930
) ;
930
931
Ok ( nth_leaf * self . leaf_len ( ) )
@@ -1052,7 +1053,7 @@ impl K2Tree {
1052
1053
#[ allow( dead_code) ]
1053
1054
fn footprint ( & self ) -> usize {
1054
1055
let mut size: usize = std:: mem:: size_of_val ( self ) ;
1055
- size += std:: mem:: size_of :: < usize > ( ) * self . slayer_starts . len ( ) ;
1056
+ size += std:: mem:: size_of :: < usize > ( ) * self . slayer_starts . len ( ) ; //DEAD
1056
1057
size += self . stems . len ( ) / 8 ;
1057
1058
size += self . leaves . len ( ) / 8 ;
1058
1059
size
0 commit comments