Skip to main content

Module arch

Module arch 

Source
Expand description

CPU architecture utilities — port of ojph_arch.h/cpp.

Provides CPU feature detection, alignment constants, and bit-manipulation helpers that wrap Rust intrinsics for clarity and C++ API compatibility.

Enums§

ArmCpuExtLevel
Supported ARM SIMD extension levels.
CpuExtLevel
Supported x86-64 SIMD extension levels, ordered by capability.

Constants§

BYTE_ALIGNMENT
Required byte alignment for SIMD buffers (AVX-512 = 64 bytes).
LOG_BYTE_ALIGNMENT
log₂(BYTE_ALIGNMENT).
OBJECT_ALIGNMENT
Required alignment for heap-allocated objects.

Functions§

calc_aligned_size
Returns the smallest multiple of alignment (in bytes) that can hold count elements of type T.
count_leading_zeros
Count leading zeros (32-bit).
count_leading_zeros_u64
Count leading zeros (64-bit).
count_trailing_zeros
Count trailing zeros (32-bit).
get_cpu_ext_level
Detects the highest supported x86-64 SIMD level at runtime.
ojph_round
Rounds a float to the nearest integer (ties away from zero), matching the C++ ojph_round behaviour.
ojph_trunc
Truncates a float toward zero, matching the C++ ojph_trunc.
population_count
Population count (number of set bits).