File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 11//! Non-identity point type.
22
33use core:: ops:: { Deref , Mul } ;
4- use core:: slice;
54
65use group:: { Curve , Group , GroupEncoding , prime:: PrimeCurveAffine } ;
76use rand_core:: CryptoRng ;
@@ -122,8 +121,7 @@ where
122121
123122 #[ allow( unsafe_code) ]
124123 // SAFETY: `NonIdentity` is `repr(transparent)`.
125- let points: & [ P ] = unsafe { slice:: from_raw_parts ( points. as_ptr ( ) . cast ( ) , N ) } ;
126- let points = points. try_into ( ) . expect ( "slice should be size `N`" ) ;
124+ let points: & [ P ; N ] = unsafe { & * ( points as * const [ Self ; N ] ) . cast ( ) } ;
127125 let affine_points = <P as BatchNormalize < _ > >:: batch_normalize ( points) ;
128126
129127 // Ensure `array::map()` can be optimized to a `memcpy`.
@@ -155,7 +153,7 @@ where
155153
156154 #[ allow( unsafe_code) ]
157155 // SAFETY: `NonIdentity` is `repr(transparent)`.
158- let points: & [ P ] = unsafe { slice:: from_raw_parts ( points. as_ptr ( ) . cast ( ) , points. len ( ) ) } ;
156+ let points: & [ P ] = unsafe { core :: slice:: from_raw_parts ( points. as_ptr ( ) . cast ( ) , points. len ( ) ) } ;
159157 let mut affine_points = <P as BatchNormalize < _ > >:: batch_normalize ( points) ;
160158
161159 // Ensure casting is safe.
You can’t perform that action at this time.
0 commit comments