@@ -1133,13 +1133,13 @@ impl<K, V> Node<K, V> {
1133
1133
#[ inline]
1134
1134
unsafe fn insert_kv ( & mut self , index : usize , key : K , val : V ) -> & mut V {
1135
1135
ptr:: copy (
1136
- self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
1137
1136
self . keys ( ) . as_ptr ( ) . offset ( index as isize ) ,
1137
+ self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
1138
1138
self . len ( ) - index
1139
1139
) ;
1140
1140
ptr:: copy (
1141
- self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
1142
1141
self . vals ( ) . as_ptr ( ) . offset ( index as isize ) ,
1142
+ self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
1143
1143
self . len ( ) - index
1144
1144
) ;
1145
1145
@@ -1155,8 +1155,8 @@ impl<K, V> Node<K, V> {
1155
1155
#[ inline]
1156
1156
unsafe fn insert_edge ( & mut self , index : usize , edge : Node < K , V > ) {
1157
1157
ptr:: copy (
1158
- self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
1159
1158
self . edges ( ) . as_ptr ( ) . offset ( index as isize ) ,
1159
+ self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize + 1 ) ,
1160
1160
self . len ( ) - index
1161
1161
) ;
1162
1162
ptr:: write ( self . edges_mut ( ) . get_unchecked_mut ( index) , edge) ;
@@ -1188,13 +1188,13 @@ impl<K, V> Node<K, V> {
1188
1188
let val = ptr:: read ( self . vals ( ) . get_unchecked ( index) ) ;
1189
1189
1190
1190
ptr:: copy (
1191
- self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
1192
1191
self . keys ( ) . as_ptr ( ) . offset ( index as isize + 1 ) ,
1192
+ self . keys_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
1193
1193
self . len ( ) - index - 1
1194
1194
) ;
1195
1195
ptr:: copy (
1196
- self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
1197
1196
self . vals ( ) . as_ptr ( ) . offset ( index as isize + 1 ) ,
1197
+ self . vals_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
1198
1198
self . len ( ) - index - 1
1199
1199
) ;
1200
1200
@@ -1209,8 +1209,8 @@ impl<K, V> Node<K, V> {
1209
1209
let edge = ptr:: read ( self . edges ( ) . get_unchecked ( index) ) ;
1210
1210
1211
1211
ptr:: copy (
1212
- self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
1213
1212
self . edges ( ) . as_ptr ( ) . offset ( index as isize + 1 ) ,
1213
+ self . edges_mut ( ) . as_mut_ptr ( ) . offset ( index as isize ) ,
1214
1214
// index can be == len+1, so do the +1 first to avoid underflow.
1215
1215
( self . len ( ) + 1 ) - index
1216
1216
) ;
@@ -1237,19 +1237,19 @@ impl<K, V> Node<K, V> {
1237
1237
right. _len = self . len ( ) / 2 ;
1238
1238
let right_offset = self . len ( ) - right. len ( ) ;
1239
1239
ptr:: copy_nonoverlapping (
1240
- right. keys_mut ( ) . as_mut_ptr ( ) ,
1241
1240
self . keys ( ) . as_ptr ( ) . offset ( right_offset as isize ) ,
1241
+ right. keys_mut ( ) . as_mut_ptr ( ) ,
1242
1242
right. len ( )
1243
1243
) ;
1244
1244
ptr:: copy_nonoverlapping (
1245
- right. vals_mut ( ) . as_mut_ptr ( ) ,
1246
1245
self . vals ( ) . as_ptr ( ) . offset ( right_offset as isize ) ,
1246
+ right. vals_mut ( ) . as_mut_ptr ( ) ,
1247
1247
right. len ( )
1248
1248
) ;
1249
1249
if !self . is_leaf ( ) {
1250
1250
ptr:: copy_nonoverlapping (
1251
- right. edges_mut ( ) . as_mut_ptr ( ) ,
1252
1251
self . edges ( ) . as_ptr ( ) . offset ( right_offset as isize ) ,
1252
+ right. edges_mut ( ) . as_mut_ptr ( ) ,
1253
1253
right. len ( ) + 1
1254
1254
) ;
1255
1255
}
@@ -1278,19 +1278,19 @@ impl<K, V> Node<K, V> {
1278
1278
ptr:: write ( self . vals_mut ( ) . get_unchecked_mut ( old_len) , val) ;
1279
1279
1280
1280
ptr:: copy_nonoverlapping (
1281
- self . keys_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
1282
1281
right. keys ( ) . as_ptr ( ) ,
1282
+ self . keys_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
1283
1283
right. len ( )
1284
1284
) ;
1285
1285
ptr:: copy_nonoverlapping (
1286
- self . vals_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
1287
1286
right. vals ( ) . as_ptr ( ) ,
1287
+ self . vals_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
1288
1288
right. len ( )
1289
1289
) ;
1290
1290
if !self . is_leaf ( ) {
1291
1291
ptr:: copy_nonoverlapping (
1292
- self . edges_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
1293
1292
right. edges ( ) . as_ptr ( ) ,
1293
+ self . edges_mut ( ) . as_mut_ptr ( ) . offset ( old_len as isize + 1 ) ,
1294
1294
right. len ( ) + 1
1295
1295
) ;
1296
1296
}
0 commit comments