22//! Types representing
33#![ allow( non_camel_case_types) ]
44
5- use crate :: simd:: { LaneCount , Select , Simd , SimdCast , SimdElement , SupportedLaneCount } ;
5+ use crate :: simd:: { Select , Simd , SimdCast , SimdElement } ;
66use core:: cmp:: Ordering ;
77use core:: { fmt, mem} ;
88
@@ -41,7 +41,6 @@ mod sealed {
4141 pub trait Sealed {
4242 fn valid < const N : usize > ( values : Simd < Self , N > ) -> bool
4343 where
44- LaneCount < N > : SupportedLaneCount ,
4544 Self : SimdElement ;
4645
4746 fn eq ( self , other : Self ) -> bool ;
@@ -69,8 +68,6 @@ macro_rules! impl_element {
6968 impl Sealed for $ty {
7069 #[ inline]
7170 fn valid<const N : usize >( value: Simd <Self , N >) -> bool
72- where
73- LaneCount <N >: SupportedLaneCount ,
7471 {
7572 // We can't use `Simd` directly, because `Simd`'s functions call this function and
7673 // we will end up with an infinite loop.
@@ -121,23 +118,19 @@ impl_element! { isize, usize }
121118/// The layout of this type is unspecified, and may change between platforms
122119/// and/or Rust versions, and code should not assume that it is equivalent to
123120/// `[T; N]`.
121+ ///
122+ /// `N` cannot be 0 and may be at most 64. This limit may be increased in
123+ /// the future.
124124#[ repr( transparent) ]
125125pub struct Mask < T , const N : usize > ( Simd < T , N > )
126126where
127- T : MaskElement ,
128- LaneCount < N > : SupportedLaneCount ;
127+ T : MaskElement ;
129128
130- impl < T , const N : usize > Copy for Mask < T , N >
131- where
132- T : MaskElement ,
133- LaneCount < N > : SupportedLaneCount ,
134- {
135- }
129+ impl < T , const N : usize > Copy for Mask < T , N > where T : MaskElement { }
136130
137131impl < T , const N : usize > Clone for Mask < T , N >
138132where
139133 T : MaskElement ,
140- LaneCount < N > : SupportedLaneCount ,
141134{
142135 #[ inline]
143136 fn clone ( & self ) -> Self {
@@ -148,7 +141,6 @@ where
148141impl < T , const N : usize > Mask < T , N >
149142where
150143 T : MaskElement ,
151- LaneCount < N > : SupportedLaneCount ,
152144{
153145 /// Constructs a mask by setting all elements to the given value.
154146 #[ inline]
@@ -315,8 +307,6 @@ where
315307 ) -> U
316308 where
317309 T : MaskElement ,
318- LaneCount < M > : SupportedLaneCount ,
319- LaneCount < N > : SupportedLaneCount ,
320310 {
321311 let resized = mask. resize :: < M > ( false ) ;
322312
@@ -421,7 +411,6 @@ where
421411impl < T , const N : usize > From < [ bool ; N ] > for Mask < T , N >
422412where
423413 T : MaskElement ,
424- LaneCount < N > : SupportedLaneCount ,
425414{
426415 #[ inline]
427416 fn from ( array : [ bool ; N ] ) -> Self {
@@ -432,7 +421,6 @@ where
432421impl < T , const N : usize > From < Mask < T , N > > for [ bool ; N ]
433422where
434423 T : MaskElement ,
435- LaneCount < N > : SupportedLaneCount ,
436424{
437425 #[ inline]
438426 fn from ( vector : Mask < T , N > ) -> Self {
@@ -443,7 +431,6 @@ where
443431impl < T , const N : usize > Default for Mask < T , N >
444432where
445433 T : MaskElement ,
446- LaneCount < N > : SupportedLaneCount ,
447434{
448435 #[ inline]
449436 fn default ( ) -> Self {
@@ -454,7 +441,6 @@ where
454441impl < T , const N : usize > PartialEq for Mask < T , N >
455442where
456443 T : MaskElement + PartialEq ,
457- LaneCount < N > : SupportedLaneCount ,
458444{
459445 #[ inline]
460446 fn eq ( & self , other : & Self ) -> bool {
@@ -465,7 +451,6 @@ where
465451impl < T , const N : usize > PartialOrd for Mask < T , N >
466452where
467453 T : MaskElement + PartialOrd ,
468- LaneCount < N > : SupportedLaneCount ,
469454{
470455 #[ inline]
471456 fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
@@ -476,7 +461,6 @@ where
476461impl < T , const N : usize > fmt:: Debug for Mask < T , N >
477462where
478463 T : MaskElement + fmt:: Debug ,
479- LaneCount < N > : SupportedLaneCount ,
480464{
481465 #[ inline]
482466 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -489,7 +473,6 @@ where
489473impl < T , const N : usize > core:: ops:: BitAnd for Mask < T , N >
490474where
491475 T : MaskElement ,
492- LaneCount < N > : SupportedLaneCount ,
493476{
494477 type Output = Self ;
495478 #[ inline]
@@ -502,7 +485,6 @@ where
502485impl < T , const N : usize > core:: ops:: BitAnd < bool > for Mask < T , N >
503486where
504487 T : MaskElement ,
505- LaneCount < N > : SupportedLaneCount ,
506488{
507489 type Output = Self ;
508490 #[ inline]
@@ -514,7 +496,6 @@ where
514496impl < T , const N : usize > core:: ops:: BitAnd < Mask < T , N > > for bool
515497where
516498 T : MaskElement ,
517- LaneCount < N > : SupportedLaneCount ,
518499{
519500 type Output = Mask < T , N > ;
520501 #[ inline]
@@ -526,7 +507,6 @@ where
526507impl < T , const N : usize > core:: ops:: BitOr for Mask < T , N >
527508where
528509 T : MaskElement ,
529- LaneCount < N > : SupportedLaneCount ,
530510{
531511 type Output = Self ;
532512 #[ inline]
@@ -539,7 +519,6 @@ where
539519impl < T , const N : usize > core:: ops:: BitOr < bool > for Mask < T , N >
540520where
541521 T : MaskElement ,
542- LaneCount < N > : SupportedLaneCount ,
543522{
544523 type Output = Self ;
545524 #[ inline]
@@ -551,7 +530,6 @@ where
551530impl < T , const N : usize > core:: ops:: BitOr < Mask < T , N > > for bool
552531where
553532 T : MaskElement ,
554- LaneCount < N > : SupportedLaneCount ,
555533{
556534 type Output = Mask < T , N > ;
557535 #[ inline]
@@ -563,7 +541,6 @@ where
563541impl < T , const N : usize > core:: ops:: BitXor for Mask < T , N >
564542where
565543 T : MaskElement ,
566- LaneCount < N > : SupportedLaneCount ,
567544{
568545 type Output = Self ;
569546 #[ inline]
@@ -576,7 +553,6 @@ where
576553impl < T , const N : usize > core:: ops:: BitXor < bool > for Mask < T , N >
577554where
578555 T : MaskElement ,
579- LaneCount < N > : SupportedLaneCount ,
580556{
581557 type Output = Self ;
582558 #[ inline]
@@ -588,7 +564,6 @@ where
588564impl < T , const N : usize > core:: ops:: BitXor < Mask < T , N > > for bool
589565where
590566 T : MaskElement ,
591- LaneCount < N > : SupportedLaneCount ,
592567{
593568 type Output = Mask < T , N > ;
594569 #[ inline]
@@ -600,7 +575,6 @@ where
600575impl < T , const N : usize > core:: ops:: Not for Mask < T , N >
601576where
602577 T : MaskElement ,
603- LaneCount < N > : SupportedLaneCount ,
604578{
605579 type Output = Mask < T , N > ;
606580 #[ inline]
@@ -612,7 +586,6 @@ where
612586impl < T , const N : usize > core:: ops:: BitAndAssign for Mask < T , N >
613587where
614588 T : MaskElement ,
615- LaneCount < N > : SupportedLaneCount ,
616589{
617590 #[ inline]
618591 fn bitand_assign ( & mut self , rhs : Self ) {
@@ -623,7 +596,6 @@ where
623596impl < T , const N : usize > core:: ops:: BitAndAssign < bool > for Mask < T , N >
624597where
625598 T : MaskElement ,
626- LaneCount < N > : SupportedLaneCount ,
627599{
628600 #[ inline]
629601 fn bitand_assign ( & mut self , rhs : bool ) {
@@ -634,7 +606,6 @@ where
634606impl < T , const N : usize > core:: ops:: BitOrAssign for Mask < T , N >
635607where
636608 T : MaskElement ,
637- LaneCount < N > : SupportedLaneCount ,
638609{
639610 #[ inline]
640611 fn bitor_assign ( & mut self , rhs : Self ) {
@@ -645,7 +616,6 @@ where
645616impl < T , const N : usize > core:: ops:: BitOrAssign < bool > for Mask < T , N >
646617where
647618 T : MaskElement ,
648- LaneCount < N > : SupportedLaneCount ,
649619{
650620 #[ inline]
651621 fn bitor_assign ( & mut self , rhs : bool ) {
@@ -656,7 +626,6 @@ where
656626impl < T , const N : usize > core:: ops:: BitXorAssign for Mask < T , N >
657627where
658628 T : MaskElement ,
659- LaneCount < N > : SupportedLaneCount ,
660629{
661630 #[ inline]
662631 fn bitxor_assign ( & mut self , rhs : Self ) {
@@ -667,7 +636,6 @@ where
667636impl < T , const N : usize > core:: ops:: BitXorAssign < bool > for Mask < T , N >
668637where
669638 T : MaskElement ,
670- LaneCount < N > : SupportedLaneCount ,
671639{
672640 #[ inline]
673641 fn bitxor_assign ( & mut self , rhs : bool ) {
@@ -679,8 +647,6 @@ macro_rules! impl_from {
679647 { $from: ty => $( $to: ty) ,* } => {
680648 $(
681649 impl <const N : usize > From <Mask <$from, N >> for Mask <$to, N >
682- where
683- LaneCount <N >: SupportedLaneCount ,
684650 {
685651 #[ inline]
686652 fn from( value: Mask <$from, N >) -> Self {
0 commit comments