polylane 0.13.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/>.

/// Denotes a SIMD data kind.
///
/// Each SIMD scalar type has its own data kind -- as denoted by this enumeration.
#[derive(
	Clone,
	Copy,
	Debug,
	Eq,
	PartialEq,
)]
pub enum DataKind {
	U8,
	U16,
	U32,
	U64,
	U128,
	Usize,

	I8,
	I16,
	I32,
	I64,
	I128,
	Isize,

	F16,
	F32,
	F64,
	F128,

	ConstPtr,
	MutPtr,
}

impl DataKind {
	/// Tests if data kind is size-like, i.e. has a representation based on [`usize`].
	#[inline(always)]
	#[must_use]
	pub const fn is_size_like(self) -> bool {
		matches!(
			self,
			| Self::Usize
			| Self::Isize
			| Self::ConstPtr
			| Self::MutPtr,
		)
	}
}