@@ -990,7 +990,7 @@ impl Hash for FixedBitSet {
990990
991991impl PartialEq for FixedBitSet {
992992 fn eq ( & self , other : & Self ) -> bool {
993- self . as_simd_slice ( ) . eq ( other. as_simd_slice ( ) ) && self . length == other . length
993+ self . length == other . length && self . as_simd_slice ( ) . eq ( other. as_simd_slice ( ) )
994994 }
995995}
996996
@@ -1201,9 +1201,9 @@ impl Masks {
12011201
12021202 Masks {
12031203 first_block,
1204- first_mask : usize:: max_value ( ) << first_rem,
1204+ first_mask : usize:: MAX << first_rem,
12051205 last_block,
1206- last_mask : ( usize:: max_value ( ) >> 1 ) >> ( BITS - last_rem - 1 ) ,
1206+ last_mask : ( usize:: MAX >> 1 ) >> ( BITS - last_rem - 1 ) ,
12071207 // this is equivalent to `MAX >> (BITS - x)` with correct semantics when x == 0.
12081208 }
12091209 }
@@ -1406,6 +1406,31 @@ impl Clone for FixedBitSet {
14061406 fn clone ( & self ) -> Self {
14071407 Self :: from_blocks_and_len ( Vec :: from ( self . as_simd_slice ( ) ) , self . length )
14081408 }
1409+
1410+ #[ inline]
1411+ fn clone_from ( & mut self , source : & Self ) {
1412+ {
1413+ let me = self . as_mut_simd_slice ( ) ;
1414+ let them = source. as_simd_slice ( ) ;
1415+ match me. len ( ) . cmp ( & them. len ( ) ) {
1416+ Ordering :: Greater => {
1417+ let ( head, tail) = me. split_at_mut ( them. len ( ) ) ;
1418+ head. copy_from_slice ( them) ;
1419+ tail. fill ( SimdBlock :: NONE ) ;
1420+ self . length = source. length ;
1421+ return ;
1422+ }
1423+ Ordering :: Equal => {
1424+ me. copy_from_slice ( them) ;
1425+ self . length = source. length ;
1426+ return ;
1427+ }
1428+ // Self is smaller than the source, this requires allocation.
1429+ Ordering :: Less => { }
1430+ }
1431+ }
1432+ * self = source. clone ( ) ;
1433+ }
14091434}
14101435
14111436/// Return **true** if the bit is enabled in the bitset,
0 commit comments