acl-js/src-js/decoder.js
// Memory allocated is always 16 bytes aligned and a multiple of 16 bytes
Memory allocated is always 16 bytes aligned and a multiple of 16 bytes
Memory allocated is always 16 bytes aligned and a multiple of 16 bytes
malloc(bufferSize) {
    if (!wasmState.module) {
      throw new Error('WASM module not ready')
    }
    const bufferSizePadded = ((bufferSize + 15) & ~15) + 16
    const bufferOffset = wasmState.instance.exports.malloc(bufferSizePadded)
    const bufferOffsetAligned = (bufferOffset + 15) & ~15
    const buffer = new Uint8Array(wasmState.heap.buffer, bufferOffsetAligned, bufferSizePadded)
    return new WASMMemory(wasmState, buffer, bufferOffset)
  }
malloc ( bufferSize ) { if ( ! wasmState . module ) { throw new Error ( 'WASM module not ready' ) } const bufferSizePadded = ( ( bufferSize + 15 ) & ~ 15 ) + 16 const bufferOffset = wasmState . instance . exports . malloc ( bufferSizePadded ) const bufferOffsetAligned = ( bufferOffset + 15 ) & ~ 15 const buffer = new Uint8Array ( wasmState . heap . buffer , bufferOffsetAligned , bufferSizePadded ) return new WASMMemory ( wasmState , buffer , bufferOffset ) }
Memory allocated is always 16 bytes aligned and a multiple of 16 bytes
Memory allocated is always 16 bytes aligned and a multiple of 16 bytes
// Round to multiple of 16 bytes and add 16 bytes of padding //console.log(`Allocating ${bufferSizePadded} bytes on WASM heap at ${bufferOffset}`) // Allocate and make sure we are aligned to 16 bytes // Create our byte buffer and add metadata