aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/common/whwasmutil.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-08-29 12:31:57 +0000
committerstephan <stephan@noemail.net>2022-08-29 12:31:57 +0000
commitf2e624ea918d6509165a07205d08acd7ffe77927 (patch)
tree9694584a08e5b98281d73254d0b11f7d2fa322a8 /ext/wasm/common/whwasmutil.js
parent9a2efd8e1f488c3c00295bc7490e3b40ebc192c4 (diff)
downloadsqlite-f2e624ea918d6509165a07205d08acd7ffe77927.tar.gz
sqlite-f2e624ea918d6509165a07205d08acd7ffe77927.zip
Add get/setPtrValue() to the common wasm utils.
FossilOrigin-Name: 24d70fc458c6002d5ff3c9f8ce7c66bde299b32aca6417c2dd1236e1412b036d
Diffstat (limited to 'ext/wasm/common/whwasmutil.js')
-rw-r--r--ext/wasm/common/whwasmutil.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/wasm/common/whwasmutil.js b/ext/wasm/common/whwasmutil.js
index e51f690e2..3fef06f72 100644
--- a/ext/wasm/common/whwasmutil.js
+++ b/ext/wasm/common/whwasmutil.js
@@ -654,6 +654,15 @@ self.WhWasmUtilInstaller = function(target){
toss('Invalid type for setMemValue(): ' + type);
};
+
+ /** Convenience form of getMemValue() intended for fetching
+ pointer-to-pointer values. */
+ target.getPtrValue = (ptr)=>target.getMemValue(ptr, ptrIR);
+
+ /** Convenience form of setMemValue() intended for setting
+ pointer-to-pointer values. */
+ target.setPtrValue = (ptr, value)=>target.setMemValue(ptr, value, ptrIR);
+
/**
Expects ptr to be a pointer into the WASM heap memory which
refers to a NUL-terminated C-style string encoded as UTF-8.