@@ -3,7 +3,6 @@ use core::mem;
33use core:: num:: NonZeroU16 ;
44
55use core:: arch:: loongarch64:: * ;
6- use mem:: transmute;
76
87pub ( crate ) type BitMaskWord = u16 ;
98pub ( crate ) type NonZeroBitMaskWord = NonZeroU16 ;
@@ -16,7 +15,7 @@ pub(crate) const BITMASK_ITER_MASK: BitMaskWord = !0;
1615///
1716/// This implementation uses a 128-bit LSX value.
1817#[ derive( Copy , Clone ) ]
19- pub ( crate ) struct Group ( v16i8 ) ;
18+ pub ( crate ) struct Group ( m128i ) ;
2019
2120// FIXME: https://github.com/rust-lang/rust-clippy/issues/3859
2221#[ allow( clippy:: use_self) ]
@@ -72,42 +71,38 @@ impl Group {
7271 /// the given value.
7372 #[ inline]
7473 pub ( crate ) fn match_tag ( self , tag : Tag ) -> BitMask {
75- #[ allow( clippy:: missing_transmute_annotations) ]
7674 unsafe {
7775 let cmp = lsx_vseq_b ( self . 0 , lsx_vreplgr2vr_b ( tag. 0 as i32 ) ) ;
78- BitMask ( lsx_vpickve2gr_hu :: < 0 > ( transmute ( lsx_vmskltz_b ( cmp) ) ) as u16 )
76+ BitMask ( lsx_vpickve2gr_hu :: < 0 > ( lsx_vmskltz_b ( cmp) ) as u16 )
7977 }
8078 }
8179
8280 /// Returns a `BitMask` indicating all tags in the group which are
8381 /// `EMPTY`.
8482 #[ inline]
8583 pub ( crate ) fn match_empty ( self ) -> BitMask {
86- #[ allow( clippy:: missing_transmute_annotations) ]
8784 unsafe {
8885 let cmp = lsx_vseqi_b :: < { Tag :: EMPTY . 0 as i8 as i32 } > ( self . 0 ) ;
89- BitMask ( lsx_vpickve2gr_hu :: < 0 > ( transmute ( lsx_vmskltz_b ( cmp) ) ) as u16 )
86+ BitMask ( lsx_vpickve2gr_hu :: < 0 > ( lsx_vmskltz_b ( cmp) ) as u16 )
9087 }
9188 }
9289
9390 /// Returns a `BitMask` indicating all tags in the group which are
9491 /// `EMPTY` or `DELETED`.
9592 #[ inline]
9693 pub ( crate ) fn match_empty_or_deleted ( self ) -> BitMask {
97- #[ allow( clippy:: missing_transmute_annotations) ]
9894 unsafe {
9995 // A tag is EMPTY or DELETED iff the high bit is set
100- BitMask ( lsx_vpickve2gr_hu :: < 0 > ( transmute ( lsx_vmskltz_b ( self . 0 ) ) ) as u16 )
96+ BitMask ( lsx_vpickve2gr_hu :: < 0 > ( lsx_vmskltz_b ( self . 0 ) ) as u16 )
10197 }
10298 }
10399
104100 /// Returns a `BitMask` indicating all tags in the group which are full.
105101 #[ inline]
106102 pub ( crate ) fn match_full ( & self ) -> BitMask {
107- #[ allow( clippy:: missing_transmute_annotations) ]
108103 unsafe {
109104 // A tag is EMPTY or DELETED iff the high bit is set
110- BitMask ( lsx_vpickve2gr_hu :: < 0 > ( transmute ( lsx_vmskgez_b ( self . 0 ) ) ) as u16 )
105+ BitMask ( lsx_vpickve2gr_hu :: < 0 > ( lsx_vmskgez_b ( self . 0 ) ) as u16 )
111106 }
112107 }
113108
@@ -124,14 +119,10 @@ impl Group {
124119 // let special = 0 > tag = 1111_1111 (true) or 0000_0000 (false)
125120 // 1111_1111 | 1000_0000 = 1111_1111
126121 // 0000_0000 | 1000_0000 = 1000_0000
127- #[ allow( clippy:: missing_transmute_annotations) ]
128122 unsafe {
129123 let zero = lsx_vreplgr2vr_b ( 0 ) ;
130124 let special = lsx_vslt_b ( self . 0 , zero) ;
131- Group ( transmute ( lsx_vor_v (
132- transmute ( special) ,
133- transmute ( lsx_vreplgr2vr_b ( Tag :: DELETED . 0 as i32 ) ) ,
134- ) ) )
125+ Group ( lsx_vor_v ( special, lsx_vreplgr2vr_b ( Tag :: DELETED . 0 as i32 ) ) )
135126 }
136127 }
137128}
0 commit comments