@@ -1133,13 +1133,13 @@ impl<K, V> Node<K, V> {
11331133 #[ inline]
11341134 unsafe fn insert_kv ( & mut self , index : usize , key : K , val : V ) -> & mut V {
11351135 ptr:: copy (
1136- self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
11371136 self . keys ( ) . as_ptr ( ) . offset ( index as isize ) ,
1137+ self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
11381138 self . len ( ) - index
11391139 ) ;
11401140 ptr:: copy (
1141- self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
11421141 self . vals ( ) . as_ptr ( ) . offset ( index as isize ) ,
1142+ self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
11431143 self . len ( ) - index
11441144 ) ;
11451145
@@ -1155,8 +1155,8 @@ impl<K, V> Node<K, V> {
11551155 #[ inline]
11561156 unsafe fn insert_edge ( & mut self , index : usize , edge : Node < K , V > ) {
11571157 ptr:: copy (
1158- self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
11591158 self . edges ( ) . as_ptr ( ) . offset ( index as isize ) ,
1159+ self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
11601160 self . len ( ) - index
11611161 ) ;
11621162 ptr:: write ( self . edges_mut ( ) . get_unchecked_mut ( index) , edge) ;
@@ -1188,13 +1188,13 @@ impl<K, V> Node<K, V> {
11881188 let val = ptr:: read ( self . vals ( ) . get_unchecked ( index) ) ;
11891189
11901190 ptr:: copy (
1191- self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
11921191 self . keys ( ) . as_ptr ( ) . offset ( index as isize + 1 ) ,
1192+ self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
11931193 self . len ( ) - index - 1
11941194 ) ;
11951195 ptr:: copy (
1196- self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
11971196 self . vals ( ) . as_ptr ( ) . offset ( index as isize + 1 ) ,
1197+ self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
11981198 self . len ( ) - index - 1
11991199 ) ;
12001200
@@ -1209,8 +1209,8 @@ impl<K, V> Node<K, V> {
12091209 let edge = ptr:: read ( self . edges ( ) . get_unchecked ( index) ) ;
12101210
12111211 ptr:: copy (
1212- self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
12131212 self . edges ( ) . as_ptr ( ) . offset ( index as isize + 1 ) ,
1213+ self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
12141214 // index can be == len+1, so do the +1 first to avoid underflow.
12151215 ( self . len ( ) + 1 ) - index
12161216 ) ;
@@ -1237,19 +1237,19 @@ impl<K, V> Node<K, V> {
12371237 right. _len = self . len ( ) / 2 ;
12381238 let right_offset = self . len ( ) - right. len ( ) ;
12391239 ptr:: copy_nonoverlapping (
1240- right. keys_mut ( ) . as_mut_ptr ( ) ,
12411240 self . keys ( ) . as_ptr ( ) . offset ( right_offset as isize ) ,
1241+ right. keys_mut ( ) . as_mut_ptr ( ) ,
12421242 right. len ( )
12431243 ) ;
12441244 ptr:: copy_nonoverlapping (
1245- right. vals_mut ( ) . as_mut_ptr ( ) ,
12461245 self . vals ( ) . as_ptr ( ) . offset ( right_offset as isize ) ,
1246+ right. vals_mut ( ) . as_mut_ptr ( ) ,
12471247 right. len ( )
12481248 ) ;
12491249 if !self . is_leaf ( ) {
12501250 ptr:: copy_nonoverlapping (
1251- right. edges_mut ( ) . as_mut_ptr ( ) ,
12521251 self . edges ( ) . as_ptr ( ) . offset ( right_offset as isize ) ,
1252+ right. edges_mut ( ) . as_mut_ptr ( ) ,
12531253 right. len ( ) + 1
12541254 ) ;
12551255 }
@@ -1278,19 +1278,19 @@ impl<K, V> Node<K, V> {
12781278 ptr:: write ( self . vals_mut ( ) . get_unchecked_mut ( old_len) , val) ;
12791279
12801280 ptr:: copy_nonoverlapping (
1281- self . keys_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
12821281 right. keys ( ) . as_ptr ( ) ,
1282+ self . keys_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
12831283 right. len ( )
12841284 ) ;
12851285 ptr:: copy_nonoverlapping (
1286- self . vals_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
12871286 right. vals ( ) . as_ptr ( ) ,
1287+ self . vals_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
12881288 right. len ( )
12891289 ) ;
12901290 if !self . is_leaf ( ) {
12911291 ptr:: copy_nonoverlapping (
1292- self . edges_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
12931292 right. edges ( ) . as_ptr ( ) ,
1293+ self . edges_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
12941294 right. len ( ) + 1
12951295 ) ;
12961296 }
0 commit comments