Commit ace55cf3 authored by Guy Watson's avatar Guy Watson
Browse files

Remove debug printing in node wrapper. Result is now the raw crc

parent 68524612
......@@ -66,13 +66,11 @@ function addToCrc(val) {
return // todo: return an error if we get here
}
crc_value = crc32(buf, crc_value)
console.log("Current crc: " + crc_value.toString(16))
}
var wasm_mem = new WebAssembly.Memory({initial:2048})
function crcMemory(){
crc_value = crc32(wasm_mem.buffer, crc_value)
console.log("Current crc after memory: " + crc_value.toString(16))
}
// Loads a WebAssembly dynamic library, returns a promise.
......@@ -123,14 +121,17 @@ loadWebAssembly(wasm)
var exports = instance.exports
assert(exports, 'no exports found')
assert(func in exports, func + ' not found in wasm module exports')
assert(crc_globals in exports, crc_globals + ' not found in wasm module exports')
// Call wasm main function and add the return value ot the crc
// Call wasm main function and add the return value to the crc
// crc value should have been updated by calls inside wasm as well
addToCrc(exports[func]())
// Update crc value with values of all globals. The exported function will call addToCrc on its own
exports[crc_globals()]
// Update crc value with contents of memory
crcMemory()
// Print crc
console.log("Crc32 value: " + crc_value.toString(16))
console.log(crc_value.toString(16))
})
.catch(res => {
console.log(res)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment