glam_det 2.0.0

A simple and fast 3D math library for games and graphics.
Documentation
// Copyright (C) 2020-2025 glam-det authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

mod bvec2;
mod bvec3;
mod bvec4;

mod bvec2x4;
mod bvec3x4;
mod bvec4x4;

#[cfg(all(target_feature = "sse2", not(feature = "scalar-math")))]
pub(crate) mod sse2;

#[cfg(all(target_feature = "sse2", not(feature = "scalar-math")))]
pub(crate) use sse2 as simd_alias;

#[cfg(all(target_feature = "simd128", not(feature = "scalar-math")))]
pub(crate) mod wasm32;

#[cfg(all(target_feature = "simd128", not(feature = "scalar-math")))]
pub(crate) use wasm32 as simd_alias;

#[cfg(all(
    target_feature = "neon",
    target_arch = "aarch64",
    not(feature = "scalar-math")
))]
pub(crate) mod neon;

#[cfg(all(
    target_feature = "neon",
    target_arch = "aarch64",
    not(feature = "scalar-math")
))]
pub(crate) use neon as simd_alias;

#[cfg(all(
    any(
        target_feature = "sse2",
        target_feature = "simd128",
        all(target_feature = "neon", target_arch = "aarch64")
    ),
    not(feature = "scalar-math"),
    feature = "ffi-safe"
))]
pub(crate) mod ffi;

#[cfg(any(
    not(any(
        target_feature = "sse2",
        target_feature = "simd128",
        all(target_feature = "neon", target_arch = "aarch64")
    )),
    feature = "scalar-math"
))]
pub(crate) mod simd_alias {
    pub type BVec3A = super::BVec3;
    pub type BVec4A = super::BVec4;
}

pub use bvec2::BVec2;
pub use bvec3::BVec3;
pub use bvec4::BVec4;

pub use bvec2x4::BVec2x4;
pub use bvec3x4::BVec3x4;
pub use bvec4x4::BVec4x4;

#[cfg(not(all(
    any(
        target_feature = "sse2",
        target_feature = "simd128",
        all(target_feature = "neon", target_arch = "aarch64")
    ),
    not(feature = "scalar-math"),
    feature = "ffi-safe"
)))]
pub use simd_alias::{BVec3A, BVec4A};

#[cfg(all(
    any(
        target_feature = "sse2",
        target_feature = "simd128",
        all(target_feature = "neon", target_arch = "aarch64")
    ),
    not(feature = "scalar-math"),
    feature = "ffi-safe"
))]
pub use ffi::{BVec3A, BVec4A};

mod const_test_bvec2 {
    const_assert_eq!(1, core::mem::align_of::<super::BVec2>());
    const_assert_eq!(2, core::mem::size_of::<super::BVec2>());
}

mod const_test_bvec3 {
    const_assert_eq!(1, core::mem::align_of::<super::BVec3>());
    const_assert_eq!(3, core::mem::size_of::<super::BVec3>());
}

mod const_test_bvec4 {
    const_assert_eq!(1, core::mem::align_of::<super::BVec4>());
    const_assert_eq!(4, core::mem::size_of::<super::BVec4>());
}

#[cfg(all(
    any(
        target_feature = "sse2",
        target_feature = "simd128",
        all(target_feature = "neon", target_arch = "aarch64")
    ),
    not(feature = "scalar-math")
))]
mod const_test_bvec3a {
    const_assert_eq!(16, core::mem::align_of::<super::BVec3A>());
    const_assert_eq!(16, core::mem::size_of::<super::BVec3A>());
}

#[cfg(all(
    any(
        target_feature = "sse2",
        target_feature = "simd128",
        all(target_feature = "neon", target_arch = "aarch64")
    ),
    not(feature = "scalar-math")
))]
mod const_test_bvec4a {
    const_assert_eq!(16, core::mem::align_of::<super::BVec4A>());
    const_assert_eq!(16, core::mem::size_of::<super::BVec4A>());
}