polylane 0.15.0

Portable and versatile SIMD.
Documentation
// Copyright 2025 Gabriel Bjørnager Jensen.
//
// 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 core::marker::PhantomData;

/// Denotes a SIMD mask layout.
///
/// This type is defined so that allowed <code>[Mask](crate::mask::Mask)&lt;T, N&gt;</code> instances may be predicated via `MaskLayout<T, N>` implementing [`ValidLayout`](crate::ValidLayout).
pub struct MaskLayout<const N: usize> {
	_phantom: PhantomData<fn() -> [bool; N]>,
}

macro_rules! valid_layouts {
	{ $($len:literal),*$(,)? } => {$(
		unsafe impl ::polylane::seal::ValidLayout for ::polylane::mask::MaskLayout<$len> {
			type SimdAlign = ::polylane::simd::align::AlignByteX1;
		}

		impl ::polylane::ValidLayout for ::polylane::mask::MaskLayout<$len> {}
	)*};
}

valid_layouts! {
	01,
	02,
	03,
	04,
	05,
	06,
	07,
	08,
	09,
	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,
	56,
	57,
	58,
	59,
	60,
	61,
	62,
	63,
	64,
}