Skip to main content

calc_element_offset

Function calc_element_offset 

Source
pub const fn calc_element_offset(idx: usize, elem_bytes: usize) -> usize
Expand description

Calculate the byte offset within a slot for an array element at index idx.

Elements are packed from offset 0 within each slot, with potential unused bytes at slot ends when elem_bytes doesn’t divide 32 evenly.