Skip to main content

encode_decomp_table_bytes

Function encode_decomp_table_bytes 

Source
pub fn encode_decomp_table_bytes(
    index: &[(u32, u32, u8)],
    pool: &[u32],
) -> Vec<u8> 
Expand description

Encode NFD_INDEX + NFD_POOL into the byte layout the wasm runtime expects.

Layout: [index_count: u32 LE] followed by index_count records of (cp: u32, pool_off: u32, pool_len: u32) - 12 bytes per record so the runtime helper can rebase as table_addr + 4 + mid * 12. Then [pool_count: u32 LE] and pool_count * u32 LE payload entries.

pool_len is widened from u8 to u32 on the wire so every entry stays on a 4-byte stride; the wasm body has no narrow load opcodes it would prefer over i32.load.