Skip to main content

Module aligned

Module aligned 

Source
Expand description

Aligned memory buffer — 64-byte aligned heap storage for hot paths.

Safe public kernels accept any &[u8] (unaligned load/store). AlignedBuffer is used internally (and optionally by callers) so encoder, decoder, and matrix rows hit aligned SIMD paths by default.

Public constructors: AlignedBuffer::zeroed, AlignedBuffer::from_slice. Internal only: new_uninit is pub(crate) so external code cannot obtain a slice over uninitialized memory.

§Usage

use rlnc_simdx::AlignedBuffer;

let src = AlignedBuffer::from_slice(&[0xABu8; 64]);
let mut dst = AlignedBuffer::zeroed(64);

assert_eq!(src.as_ptr() as usize % 64, 0);
// Safe public kernel — no `unsafe` required
rlnc_simdx::kernel::scale(0x03, &src, &mut dst);
assert_eq!(dst.len(), 64);

Structs§

AlignedBuffer
A heap-allocated byte buffer with guaranteed 64-byte alignment.

Constants§

ALIGN
AVX-512 requires 64-byte alignment for aligned load/store instructions. Using 64 as the default covers all tiers: SSE (16), AVX2 (32), AVX-512 (64).