summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2020-07-07 00:17:02 +0300
committerGitHub <noreply@github.com>2020-07-06 14:17:02 -0700
commit49421e42a8082a1b75dda65411af3fb4b0ba9fe5 (patch)
treef52993334aaca68ab69bb24a3e462bcfdc65703e /src
parentcd0cc95e2794375c463a69833b1ccc9cc96d597c (diff)
downloadbinaryen-49421e42a8082a1b75dda65411af3fb4b0ba9fe5.tar.gz
binaryen-49421e42a8082a1b75dda65411af3fb4b0ba9fe5.tar.bz2
binaryen-49421e42a8082a1b75dda65411af3fb4b0ba9fe5.zip
More efficient isInteger util (#2945)
Diffstat (limited to 'src')
-rw-r--r--src/support/safe_integer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/support/safe_integer.cpp b/src/support/safe_integer.cpp
index 23ef84b22..d43f7a6aa 100644
--- a/src/support/safe_integer.cpp
+++ b/src/support/safe_integer.cpp
@@ -22,7 +22,7 @@
using namespace wasm;
-bool wasm::isInteger(double x) { return fmod(x, 1) == 0; }
+bool wasm::isInteger(double x) { return trunc(x) == x && !std::isinf(x); }
bool wasm::isUInteger32(double x) {
return !std::signbit(x) && isInteger(x) &&