Trait IndexedLookup

Source
pub trait IndexedLookup<F: TowerField> {
    // Required methods
    fn log_size(&self) -> usize;
    fn entry_to_index(&self, entry: &[F]) -> usize;
    fn index_to_entry(&self, index: usize, entry: &mut [F]);
}
Expand description

Indexed lookup tables are fixed-size tables where every entry is easily determined by its index.

Indexed lookup tables cover a large and useful class of tables, such as lookup tables for bitwise operations, addition of small integer values, multiplication, etc. The entry encodes an input and an output, where the index encodes the input. For example, a bitwise AND table would have 2 8-bit input values and one 8-bit output value. The index encodes the input by concatenating the 8-bit inputs into a 16-bit unsigned integer.

This trait helps to count the number of times a table, which is already filled, reads from a lookup table. See the documentation for tally for more information.

Required Methods§

Source

fn log_size(&self) -> usize

Binary logarithm of the number of table entries.

Source

fn entry_to_index(&self, entry: &[F]) -> usize

Encode a table entry as a table index.

Source

fn index_to_entry(&self, index: usize, entry: &mut [F])

Decode a table index to an entry.

Implementors§