Skip to main content

simd_width

Function simd_width 

Source
pub const fn simd_width() -> usize
Expand description

Returns the SIMD width for the current build target.

Dispatches at compile time based on enabled features and target architecture:

  • AVX2 (x86_64): 8 lanes (256-bit / 32-bit float)
  • SSE2 / no-AVX2 (x86_64 without avx2): 4 lanes (128-bit)
  • NEON (aarch64): 4 lanes (128-bit)
  • Other targets with simd (wasm32, …): 1, no SIMD path, the scalar code runs
  • Scalar fallback (no simd feature): 1

Use the SIMD_WIDTH constant for a zero-cost compile-time value.