polylane 0.14.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 crate::ValidLayout;
use crate::cmp::SimdPartialOrd;
use crate::mask::{Mask, MaskLayout};

/// SIMD equivalent of [`Ord`].
pub trait SimdOrd<const N: usize>: SimdPartialOrd<N>
where
	MaskLayout<N>: ValidLayout,
{
	/// Tests for the minimum values between SIMD elements.
	#[must_use]
	fn simd_min(self, other: Self) -> Mask<N>;

	/// Tests for the maximum values between SIMD elements.
	#[must_use]
	fn simd_max(self, other: Self) -> Mask<N>;

	/// Clamps the elements of `self` to the equivalent element values in `min` and `max`.
	///
	/// # Panics
	///
	/// Implementations of this method should panic if any value of `min` is greater than the equivalent value in `max`.
	#[must_use]
	fn simd_clamp(self, min: Self, max: Self) -> Self;
}