pub struct Table64 { /* private fields */ }Expand description
A SIMD-optimized 64-entry lookup table, able to do extremely efficient lookups in ARM NEON and Intel AVX-512VBMI.
§2D Interpretation
Table64 can also be viewed as an 8×8 two-dimensional table stored in row-major order:
col 0 col 1 col 2 col 3 col 4 col 5 col 6 col 7
row 0: 0 1 2 3 4 5 6 7
row 1: 8 9 10 11 12 13 14 15
row 2: 16 17 18 19 20 21 22 23
row 3: 24 25 26 27 28 29 30 31
row 4: 32 33 34 35 36 37 38 39
row 5: 40 41 42 43 44 45 46 47
row 6: 48 49 50 51 52 53 54 55
row 7: 56 57 58 59 60 61 62 63Use lookup_one_2d to perform lookups using (row, column) coordinates.
Implementations§
Source§impl Table64
impl Table64
pub fn new(table: &[u8; 64]) -> Self
Sourcepub fn lookup_one(&self, idx: u8x16) -> u8x16
pub fn lookup_one(&self, idx: u8x16) -> u8x16
Single-vector lookup: each byte of idx (0..63) selects from this 64B table.
Returns a u8x16 with the looked-up values.
Sourcepub fn lookup_one_2d(&self, rows: u8x16, cols: u8x16) -> u8x16
pub fn lookup_one_2d(&self, rows: u8x16, cols: u8x16) -> u8x16
2D lookup: treats the 64-entry table as an 8×8 row-major matrix.
Each lane computes index = row * 8 + col and looks up the corresponding value.
§Arguments
rows: Row indices (0..7) for each of the 16 lanescols: Column indices (0..7) for each of the 16 lanes
§Panics (debug only)
Debug-asserts that all row and column values are in range 0..8.
§Example
ⓘ
let table = Table64::new(&data);
let rows = u8x16::from([0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7]);
let cols = u8x16::from([0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7]);
let result = table.lookup_one_2d(rows, cols);
// Looks up indices [0, 8, 16, 24, 32, 40, 48, 56, 7, 15, 23, 31, 39, 47, 55, 63]Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table64
impl RefUnwindSafe for Table64
impl Send for Table64
impl Sync for Table64
impl Unpin for Table64
impl UnwindSafe for Table64
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)