Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xsmith
WebAssembly Sandbox
Commits
ace55cf3
Commit
ace55cf3
authored
Mar 10, 2020
by
Guy Watson
Browse files
Remove debug printing in node wrapper. Result is now the raw crc
parent
68524612
Changes
1
Hide whitespace changes
Inline
Side-by-side
load-node.js
View file @
ace55cf3
...
...
@@ -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
o
t the crc
// Call wasm main function and add the return value t
o
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment