1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright © 2021-2022 Rouven Spreckels <rs@qu1x.dev>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use super::{Select, SimdMask};
use core::simd::{LaneCount, Mask, SupportedLaneCount};

impl<const LANES: usize> SimdMask<LANES> for Mask<i32, LANES>
where
	LaneCount<LANES>: SupportedLaneCount,
{
	#[inline]
	fn splat(value: bool) -> Self {
		Self::splat(value)
	}

	#[inline]
	fn from_array(array: [bool; LANES]) -> Self {
		Self::from(array)
	}
	#[inline]
	fn to_array(self) -> [bool; LANES] {
		self.to_array()
	}

	#[inline]
	fn all(self) -> bool {
		self.all()
	}
	#[inline]
	fn any(self) -> bool {
		self.any()
	}

	#[inline]
	fn set(&mut self, lane: usize, value: bool) {
		self.set(lane, value);
	}
	#[inline]
	fn test(&self, lane: usize) -> bool {
		self.test(lane)
	}
}

impl<const LANES: usize> Select<Mask<i32, LANES>> for Mask<i32, LANES>
where
	LaneCount<LANES>: SupportedLaneCount,
{
	#[inline]
	fn select(mask: Mask<i32, LANES>, true_values: Self, false_values: Self) -> Self {
		mask.select_mask(true_values, false_values)
	}
}