@@ -213,7 +213,7 @@ where
213
213
#[ inline]
214
214
#[ cfg( not( bootstrap) ) ]
215
215
pub fn cast < U : SimdElement > ( self ) -> Simd < U , LANES > {
216
- // Safety: The input argument is a vector of a known SIMD type.
216
+ // Safety: The input argument is a vector of a valid SIMD element type.
217
217
unsafe { intrinsics:: simd_as ( self ) }
218
218
}
219
219
@@ -624,61 +624,85 @@ pub unsafe trait SimdElement: Sealed + Copy {
624
624
}
625
625
626
626
impl Sealed for u8 { }
627
+
628
+ // Safety: u8 is a valid SIMD element type, and is supported by this API
627
629
unsafe impl SimdElement for u8 {
628
630
type Mask = i8 ;
629
631
}
630
632
631
633
impl Sealed for u16 { }
634
+
635
+ // Safety: u16 is a valid SIMD element type, and is supported by this API
632
636
unsafe impl SimdElement for u16 {
633
637
type Mask = i16 ;
634
638
}
635
639
636
640
impl Sealed for u32 { }
641
+
642
+ // Safety: u32 is a valid SIMD element type, and is supported by this API
637
643
unsafe impl SimdElement for u32 {
638
644
type Mask = i32 ;
639
645
}
640
646
641
647
impl Sealed for u64 { }
648
+
649
+ // Safety: u64 is a valid SIMD element type, and is supported by this API
642
650
unsafe impl SimdElement for u64 {
643
651
type Mask = i64 ;
644
652
}
645
653
646
654
impl Sealed for usize { }
655
+
656
+ // Safety: usize is a valid SIMD element type, and is supported by this API
647
657
unsafe impl SimdElement for usize {
648
658
type Mask = isize ;
649
659
}
650
660
651
661
impl Sealed for i8 { }
662
+
663
+ // Safety: i8 is a valid SIMD element type, and is supported by this API
652
664
unsafe impl SimdElement for i8 {
653
665
type Mask = i8 ;
654
666
}
655
667
656
668
impl Sealed for i16 { }
669
+
670
+ // Safety: i16 is a valid SIMD element type, and is supported by this API
657
671
unsafe impl SimdElement for i16 {
658
672
type Mask = i16 ;
659
673
}
660
674
661
675
impl Sealed for i32 { }
676
+
677
+ // Safety: i32 is a valid SIMD element type, and is supported by this API
662
678
unsafe impl SimdElement for i32 {
663
679
type Mask = i32 ;
664
680
}
665
681
666
682
impl Sealed for i64 { }
683
+
684
+ // Safety: i64 is a valid SIMD element type, and is supported by this API
667
685
unsafe impl SimdElement for i64 {
668
686
type Mask = i64 ;
669
687
}
670
688
671
689
impl Sealed for isize { }
690
+
691
+ // Safety: isize is a valid SIMD element type, and is supported by this API
672
692
unsafe impl SimdElement for isize {
673
693
type Mask = isize ;
674
694
}
675
695
676
696
impl Sealed for f32 { }
697
+
698
+ // Safety: f32 is a valid SIMD element type, and is supported by this API
677
699
unsafe impl SimdElement for f32 {
678
700
type Mask = i32 ;
679
701
}
680
702
681
703
impl Sealed for f64 { }
704
+
705
+ // Safety: f64 is a valid SIMD element type, and is supported by this API
682
706
unsafe impl SimdElement for f64 {
683
707
type Mask = i64 ;
684
708
}
0 commit comments