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

//! Portable and versatile SIMD.
//!
//! This crate defines SIMD facilities thay may be used on any given platform in any way that ordinary arithmetic primitives are used.
//!
//! # Testing
//!
//! It is recommended to use the `.env` environment file when testing:
//!
//! ```sh
//! source .env; cargo test --all-features
//! ```

#![no_std]

#![cfg_attr(feature = "f16",           feature(f16))]
#![cfg_attr(feature = "f128",          feature(f128))]
#![cfg_attr(feature = "freeze",        feature(freeze))]
#![cfg_attr(feature = "thin",          feature(ptr_metadata))]
#![cfg_attr(feature = "unstable_docs", feature(doc_cfg, intra_doc_pointers))]

extern crate self as polylane;

#[cfg(any(feature = "alloc", doc, test))]
extern crate alloc;

#[cfg(any(feature = "std", doc, test))]
extern crate std;

pub mod cmp;
pub mod mask;
pub mod num;
pub mod prelude;
pub mod simd;

mod compat;
mod detail;

/// Constructs a SIMD vector.
///
/// # Examples
///
/// ```rust
/// use polylane::simd;
///
/// let v0 = simd![1.0f64; 3];
/// let v1 = simd![1.0f64, 1.0, 1.0];
///
/// assert_eq!(v0.to_array(), [1.0f64, 1.0, 1.0]);
/// assert_eq!(v1.to_array(), [1.0f64; 3]);
/// ```
#[macro_export]
macro_rules! simd {
	[$value:expr; $len:expr] => {{
		::polylane::simd::Simd::from_array([$value; $len])
	}};

	[$($value:expr),+$(,)?] => {{
		::polylane::simd::Simd::from_array([$($value, )+])
	}};
}