@@ -641,7 +641,7 @@ impl<A: Array> SmallVec<A> {
641
641
}
642
642
let ( ptr, len_ptr, _) = self . triple_mut ( ) ;
643
643
* len_ptr = len + 1 ;
644
- ptr:: write ( ptr. offset ( len as isize ) , value) ;
644
+ ptr:: write ( ptr. add ( len) , value) ;
645
645
}
646
646
}
647
647
@@ -655,7 +655,7 @@ impl<A: Array> SmallVec<A> {
655
655
}
656
656
let last_index = * len_ptr - 1 ;
657
657
* len_ptr = last_index;
658
- Some ( ptr:: read ( ptr. offset ( last_index as isize ) ) )
658
+ Some ( ptr:: read ( ptr. add ( last_index) ) )
659
659
}
660
660
}
661
661
@@ -761,7 +761,7 @@ impl<A: Array> SmallVec<A> {
761
761
while len < * len_ptr {
762
762
let last_index = * len_ptr - 1 ;
763
763
* len_ptr = last_index;
764
- ptr:: drop_in_place ( ptr. offset ( last_index as isize ) ) ;
764
+ ptr:: drop_in_place ( ptr. add ( last_index) ) ;
765
765
}
766
766
}
767
767
}
@@ -809,7 +809,7 @@ impl<A: Array> SmallVec<A> {
809
809
let len = * len_ptr;
810
810
assert ! ( index < len) ;
811
811
* len_ptr = len - 1 ;
812
- ptr = ptr. offset ( index as isize ) ;
812
+ ptr = ptr. add ( index) ;
813
813
let item = ptr:: read ( ptr) ;
814
814
ptr:: copy ( ptr. offset ( 1 ) , ptr, len - index - 1 ) ;
815
815
item
@@ -827,7 +827,7 @@ impl<A: Array> SmallVec<A> {
827
827
let len = * len_ptr;
828
828
assert ! ( index <= len) ;
829
829
* len_ptr = len + 1 ;
830
- ptr = ptr. offset ( index as isize ) ;
830
+ ptr = ptr. add ( index) ;
831
831
ptr:: copy ( ptr, ptr. offset ( 1 ) , len - index) ;
832
832
ptr:: write ( ptr, element) ;
833
833
}
@@ -849,22 +849,22 @@ impl<A: Array> SmallVec<A> {
849
849
unsafe {
850
850
let old_len = self . len ( ) ;
851
851
assert ! ( index <= old_len) ;
852
- let mut ptr = self . as_mut_ptr ( ) . offset ( index as isize ) ;
852
+ let mut ptr = self . as_mut_ptr ( ) . add ( index) ;
853
853
854
854
// Move the trailing elements.
855
- ptr:: copy ( ptr, ptr. offset ( lower_size_bound as isize ) , old_len - index) ;
855
+ ptr:: copy ( ptr, ptr. add ( lower_size_bound) , old_len - index) ;
856
856
857
857
// In case the iterator panics, don't double-drop the items we just copied above.
858
858
self . set_len ( index) ;
859
859
860
860
let mut num_added = 0 ;
861
861
for element in iter {
862
- let mut cur = ptr. offset ( num_added as isize ) ;
862
+ let mut cur = ptr. add ( num_added) ;
863
863
if num_added >= lower_size_bound {
864
864
// Iterator provided more elements than the hint. Move trailing items again.
865
865
self . reserve ( 1 ) ;
866
- ptr = self . as_mut_ptr ( ) . offset ( index as isize ) ;
867
- cur = ptr. offset ( num_added as isize ) ;
866
+ ptr = self . as_mut_ptr ( ) . add ( index) ;
867
+ cur = ptr. add ( num_added) ;
868
868
ptr:: copy ( cur, cur. offset ( 1 ) , old_len - index) ;
869
869
}
870
870
ptr:: write ( cur, element) ;
@@ -873,8 +873,8 @@ impl<A: Array> SmallVec<A> {
873
873
if num_added < lower_size_bound {
874
874
// Iterator provided fewer elements than the hint
875
875
ptr:: copy (
876
- ptr. offset ( lower_size_bound as isize ) ,
877
- ptr. offset ( num_added as isize ) ,
876
+ ptr. add ( lower_size_bound) ,
877
+ ptr. add ( num_added) ,
878
878
old_len - index,
879
879
) ;
880
880
}
@@ -957,8 +957,8 @@ impl<A: Array> SmallVec<A> {
957
957
958
958
unsafe {
959
959
for r in 1 ..len {
960
- let p_r = ptr. offset ( r as isize ) ;
961
- let p_wm1 = ptr. offset ( ( w - 1 ) as isize ) ;
960
+ let p_r = ptr. add ( r ) ;
961
+ let p_wm1 = ptr. add ( w - 1 ) ;
962
962
if !same_bucket ( & mut * p_r, & mut * p_wm1) {
963
963
if r != w {
964
964
let p_w = p_wm1. offset ( 1 ) ;
@@ -1103,8 +1103,8 @@ where
1103
1103
1104
1104
unsafe {
1105
1105
let slice_ptr = slice. as_ptr ( ) ;
1106
- let ptr = self . as_mut_ptr ( ) . offset ( index as isize ) ;
1107
- ptr:: copy ( ptr, ptr. offset ( slice. len ( ) as isize ) , len - index) ;
1106
+ let ptr = self . as_mut_ptr ( ) . add ( index) ;
1107
+ ptr:: copy ( ptr, ptr. add ( slice. len ( ) ) , len - index) ;
1108
1108
ptr:: copy_nonoverlapping ( slice_ptr, ptr, slice. len ( ) ) ;
1109
1109
self . set_len ( len + slice. len ( ) ) ;
1110
1110
}
@@ -1318,7 +1318,7 @@ where
1318
1318
#[ cfg( not( feature = "specialization" ) ) ]
1319
1319
#[ inline]
1320
1320
fn from ( slice : & ' a [ A :: Item ] ) -> SmallVec < A > {
1321
- slice. into_iter ( ) . cloned ( ) . collect ( )
1321
+ slice. iter ( ) . cloned ( ) . collect ( )
1322
1322
}
1323
1323
1324
1324
#[ cfg( feature = "specialization" ) ]
@@ -1384,7 +1384,7 @@ impl<A: Array> Extend<A::Item> for SmallVec<A> {
1384
1384
let mut len = SetLenOnDrop :: new ( len_ptr) ;
1385
1385
while len. get ( ) < cap {
1386
1386
if let Some ( out) = iter. next ( ) {
1387
- ptr:: write ( ptr. offset ( len. get ( ) as isize ) , out) ;
1387
+ ptr:: write ( ptr. add ( len. get ( ) ) , out) ;
1388
1388
len. increment_len ( 1 ) ;
1389
1389
} else {
1390
1390
return ;
@@ -1463,10 +1463,6 @@ where
1463
1463
fn eq ( & self , other : & SmallVec < B > ) -> bool {
1464
1464
self [ ..] == other[ ..]
1465
1465
}
1466
- #[ inline]
1467
- fn ne ( & self , other : & SmallVec < B > ) -> bool {
1468
- self [ ..] != other[ ..]
1469
- }
1470
1466
}
1471
1467
1472
1468
impl < A : Array > Eq for SmallVec < A > where A :: Item : Eq { }
@@ -1550,7 +1546,7 @@ impl<A: Array> DoubleEndedIterator for IntoIter<A> {
1550
1546
} else {
1551
1547
unsafe {
1552
1548
self . end -= 1 ;
1553
- Some ( ptr:: read ( self . data . as_ptr ( ) . offset ( self . end as isize ) ) )
1549
+ Some ( ptr:: read ( self . data . as_ptr ( ) . add ( self . end ) ) )
1554
1550
}
1555
1551
}
1556
1552
}
@@ -1613,7 +1609,7 @@ impl<'a> SetLenOnDrop<'a> {
1613
1609
fn new ( len : & ' a mut usize ) -> Self {
1614
1610
SetLenOnDrop {
1615
1611
local_len : * len,
1616
- len : len ,
1612
+ len,
1617
1613
}
1618
1614
}
1619
1615
@@ -1649,7 +1645,7 @@ macro_rules! impl_array(
1649
1645
impl_array ! (
1650
1646
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 20 , 24 , 32 , 36 , 0x40 , 0x60 , 0x80 ,
1651
1647
0x100 , 0x200 , 0x400 , 0x600 , 0x800 , 0x1000 , 0x2000 , 0x4000 , 0x6000 , 0x8000 , 0x10000 , 0x20000 ,
1652
- 0x40000 , 0x60000 , 0x80000 , 0x100000
1648
+ 0x40000 , 0x60000 , 0x80000 , 0x10_0000
1653
1649
) ;
1654
1650
1655
1651
#[ cfg( test) ]
0 commit comments