summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2020-10-01 15:49:40 +0300
committerGitHub <noreply@github.com>2020-10-01 14:49:40 +0200
commite1a843b15d9939eaa258261f5fed67ea9c493a65 (patch)
tree20ee07241fd721a63bea8f23761ed2a86dcd8a7e /src/js/binaryen.js-post.js
parent2a935b64dde22671644c4712d0f45e8df60f94eb (diff)
downloadbinaryen-e1a843b15d9939eaa258261f5fed67ea9c493a65.tar.gz
binaryen-e1a843b15d9939eaa258261f5fed67ea9c493a65.tar.bz2
binaryen-e1a843b15d9939eaa258261f5fed67ea9c493a65.zip
Add C and JS APIs for fast math (#3188)
Adds `BinaryenGetFastMath` and `BinaryenSetFastMath` to the C API, respectively `binaryen.getFastMath` and `binaryen.setFastMath` to the JS API.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 529474098..3cce22411 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -3046,6 +3046,18 @@ Module['setLowMemoryUnused'] = function(on) {
Module['_BinaryenSetLowMemoryUnused'](on);
};
+// Gets whether fast math optimizations are enabled, ignoring for example
+// corner cases of floating-point math like NaN changes.
+Module['getFastMath'] = function() {
+ return Boolean(Module['_BinaryenGetFastMath']());
+};
+
+// Enables or disables fast math optimizations, ignoring for example
+// corner cases of floating-point math like NaN changes.
+Module['setFastMath'] = function(value) {
+ Module['_BinaryenSetFastMath'](value);
+};
+
// Gets the value of the specified arbitrary pass argument.
Module['getPassArgument'] = function(key) {
return preserveStack(() => {