2
2
//! Types representing
3
3
#![ allow( non_camel_case_types) ]
4
4
5
- use crate :: simd:: { LaneCount , Select , Simd , SimdCast , SimdElement , SupportedLaneCount } ;
5
+ use crate :: simd:: { Select , Simd , SimdCast , SimdElement } ;
6
6
use core:: cmp:: Ordering ;
7
7
use core:: { fmt, mem} ;
8
8
@@ -41,7 +41,6 @@ mod sealed {
41
41
pub trait Sealed {
42
42
fn valid < const N : usize > ( values : Simd < Self , N > ) -> bool
43
43
where
44
- LaneCount < N > : SupportedLaneCount ,
45
44
Self : SimdElement ;
46
45
47
46
fn eq ( self , other : Self ) -> bool ;
@@ -69,8 +68,6 @@ macro_rules! impl_element {
69
68
impl Sealed for $ty {
70
69
#[ inline]
71
70
fn valid<const N : usize >( value: Simd <Self , N >) -> bool
72
- where
73
- LaneCount <N >: SupportedLaneCount ,
74
71
{
75
72
// We can't use `Simd` directly, because `Simd`'s functions call this function and
76
73
// we will end up with an infinite loop.
@@ -121,23 +118,19 @@ impl_element! { isize, usize }
121
118
/// The layout of this type is unspecified, and may change between platforms
122
119
/// and/or Rust versions, and code should not assume that it is equivalent to
123
120
/// `[T; N]`.
121
+ ///
122
+ /// `N` cannot be 0 and may be at most 64. This limit may be increased in
123
+ /// the future.
124
124
#[ repr( transparent) ]
125
125
pub struct Mask < T , const N : usize > ( Simd < T , N > )
126
126
where
127
- T : MaskElement ,
128
- LaneCount < N > : SupportedLaneCount ;
127
+ T : MaskElement ;
129
128
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 { }
136
130
137
131
impl < T , const N : usize > Clone for Mask < T , N >
138
132
where
139
133
T : MaskElement ,
140
- LaneCount < N > : SupportedLaneCount ,
141
134
{
142
135
#[ inline]
143
136
fn clone ( & self ) -> Self {
@@ -148,7 +141,6 @@ where
148
141
impl < T , const N : usize > Mask < T , N >
149
142
where
150
143
T : MaskElement ,
151
- LaneCount < N > : SupportedLaneCount ,
152
144
{
153
145
/// Constructs a mask by setting all elements to the given value.
154
146
#[ inline]
@@ -315,8 +307,6 @@ where
315
307
) -> U
316
308
where
317
309
T : MaskElement ,
318
- LaneCount < M > : SupportedLaneCount ,
319
- LaneCount < N > : SupportedLaneCount ,
320
310
{
321
311
let resized = mask. resize :: < M > ( false ) ;
322
312
@@ -421,7 +411,6 @@ where
421
411
impl < T , const N : usize > From < [ bool ; N ] > for Mask < T , N >
422
412
where
423
413
T : MaskElement ,
424
- LaneCount < N > : SupportedLaneCount ,
425
414
{
426
415
#[ inline]
427
416
fn from ( array : [ bool ; N ] ) -> Self {
@@ -432,7 +421,6 @@ where
432
421
impl < T , const N : usize > From < Mask < T , N > > for [ bool ; N ]
433
422
where
434
423
T : MaskElement ,
435
- LaneCount < N > : SupportedLaneCount ,
436
424
{
437
425
#[ inline]
438
426
fn from ( vector : Mask < T , N > ) -> Self {
@@ -443,7 +431,6 @@ where
443
431
impl < T , const N : usize > Default for Mask < T , N >
444
432
where
445
433
T : MaskElement ,
446
- LaneCount < N > : SupportedLaneCount ,
447
434
{
448
435
#[ inline]
449
436
fn default ( ) -> Self {
@@ -454,7 +441,6 @@ where
454
441
impl < T , const N : usize > PartialEq for Mask < T , N >
455
442
where
456
443
T : MaskElement + PartialEq ,
457
- LaneCount < N > : SupportedLaneCount ,
458
444
{
459
445
#[ inline]
460
446
fn eq ( & self , other : & Self ) -> bool {
@@ -465,7 +451,6 @@ where
465
451
impl < T , const N : usize > PartialOrd for Mask < T , N >
466
452
where
467
453
T : MaskElement + PartialOrd ,
468
- LaneCount < N > : SupportedLaneCount ,
469
454
{
470
455
#[ inline]
471
456
fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
@@ -476,7 +461,6 @@ where
476
461
impl < T , const N : usize > fmt:: Debug for Mask < T , N >
477
462
where
478
463
T : MaskElement + fmt:: Debug ,
479
- LaneCount < N > : SupportedLaneCount ,
480
464
{
481
465
#[ inline]
482
466
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -489,7 +473,6 @@ where
489
473
impl < T , const N : usize > core:: ops:: BitAnd for Mask < T , N >
490
474
where
491
475
T : MaskElement ,
492
- LaneCount < N > : SupportedLaneCount ,
493
476
{
494
477
type Output = Self ;
495
478
#[ inline]
@@ -502,7 +485,6 @@ where
502
485
impl < T , const N : usize > core:: ops:: BitAnd < bool > for Mask < T , N >
503
486
where
504
487
T : MaskElement ,
505
- LaneCount < N > : SupportedLaneCount ,
506
488
{
507
489
type Output = Self ;
508
490
#[ inline]
@@ -514,7 +496,6 @@ where
514
496
impl < T , const N : usize > core:: ops:: BitAnd < Mask < T , N > > for bool
515
497
where
516
498
T : MaskElement ,
517
- LaneCount < N > : SupportedLaneCount ,
518
499
{
519
500
type Output = Mask < T , N > ;
520
501
#[ inline]
@@ -526,7 +507,6 @@ where
526
507
impl < T , const N : usize > core:: ops:: BitOr for Mask < T , N >
527
508
where
528
509
T : MaskElement ,
529
- LaneCount < N > : SupportedLaneCount ,
530
510
{
531
511
type Output = Self ;
532
512
#[ inline]
@@ -539,7 +519,6 @@ where
539
519
impl < T , const N : usize > core:: ops:: BitOr < bool > for Mask < T , N >
540
520
where
541
521
T : MaskElement ,
542
- LaneCount < N > : SupportedLaneCount ,
543
522
{
544
523
type Output = Self ;
545
524
#[ inline]
@@ -551,7 +530,6 @@ where
551
530
impl < T , const N : usize > core:: ops:: BitOr < Mask < T , N > > for bool
552
531
where
553
532
T : MaskElement ,
554
- LaneCount < N > : SupportedLaneCount ,
555
533
{
556
534
type Output = Mask < T , N > ;
557
535
#[ inline]
@@ -563,7 +541,6 @@ where
563
541
impl < T , const N : usize > core:: ops:: BitXor for Mask < T , N >
564
542
where
565
543
T : MaskElement ,
566
- LaneCount < N > : SupportedLaneCount ,
567
544
{
568
545
type Output = Self ;
569
546
#[ inline]
@@ -576,7 +553,6 @@ where
576
553
impl < T , const N : usize > core:: ops:: BitXor < bool > for Mask < T , N >
577
554
where
578
555
T : MaskElement ,
579
- LaneCount < N > : SupportedLaneCount ,
580
556
{
581
557
type Output = Self ;
582
558
#[ inline]
@@ -588,7 +564,6 @@ where
588
564
impl < T , const N : usize > core:: ops:: BitXor < Mask < T , N > > for bool
589
565
where
590
566
T : MaskElement ,
591
- LaneCount < N > : SupportedLaneCount ,
592
567
{
593
568
type Output = Mask < T , N > ;
594
569
#[ inline]
@@ -600,7 +575,6 @@ where
600
575
impl < T , const N : usize > core:: ops:: Not for Mask < T , N >
601
576
where
602
577
T : MaskElement ,
603
- LaneCount < N > : SupportedLaneCount ,
604
578
{
605
579
type Output = Mask < T , N > ;
606
580
#[ inline]
@@ -612,7 +586,6 @@ where
612
586
impl < T , const N : usize > core:: ops:: BitAndAssign for Mask < T , N >
613
587
where
614
588
T : MaskElement ,
615
- LaneCount < N > : SupportedLaneCount ,
616
589
{
617
590
#[ inline]
618
591
fn bitand_assign ( & mut self , rhs : Self ) {
@@ -623,7 +596,6 @@ where
623
596
impl < T , const N : usize > core:: ops:: BitAndAssign < bool > for Mask < T , N >
624
597
where
625
598
T : MaskElement ,
626
- LaneCount < N > : SupportedLaneCount ,
627
599
{
628
600
#[ inline]
629
601
fn bitand_assign ( & mut self , rhs : bool ) {
@@ -634,7 +606,6 @@ where
634
606
impl < T , const N : usize > core:: ops:: BitOrAssign for Mask < T , N >
635
607
where
636
608
T : MaskElement ,
637
- LaneCount < N > : SupportedLaneCount ,
638
609
{
639
610
#[ inline]
640
611
fn bitor_assign ( & mut self , rhs : Self ) {
@@ -645,7 +616,6 @@ where
645
616
impl < T , const N : usize > core:: ops:: BitOrAssign < bool > for Mask < T , N >
646
617
where
647
618
T : MaskElement ,
648
- LaneCount < N > : SupportedLaneCount ,
649
619
{
650
620
#[ inline]
651
621
fn bitor_assign ( & mut self , rhs : bool ) {
@@ -656,7 +626,6 @@ where
656
626
impl < T , const N : usize > core:: ops:: BitXorAssign for Mask < T , N >
657
627
where
658
628
T : MaskElement ,
659
- LaneCount < N > : SupportedLaneCount ,
660
629
{
661
630
#[ inline]
662
631
fn bitxor_assign ( & mut self , rhs : Self ) {
@@ -667,7 +636,6 @@ where
667
636
impl < T , const N : usize > core:: ops:: BitXorAssign < bool > for Mask < T , N >
668
637
where
669
638
T : MaskElement ,
670
- LaneCount < N > : SupportedLaneCount ,
671
639
{
672
640
#[ inline]
673
641
fn bitxor_assign ( & mut self , rhs : bool ) {
@@ -679,8 +647,6 @@ macro_rules! impl_from {
679
647
{ $from: ty => $( $to: ty) ,* } => {
680
648
$(
681
649
impl <const N : usize > From <Mask <$from, N >> for Mask <$to, N >
682
- where
683
- LaneCount <N >: SupportedLaneCount ,
684
650
{
685
651
#[ inline]
686
652
fn from( value: Mask <$from, N >) -> Self {
0 commit comments