summaryrefslogtreecommitdiff
path: root/third_party/base/numerics/safe_math_impl.h
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-01-24 22:05:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-24 22:05:20 +0000
commitf9f1a5dd73b918d50bcd3a4b461b87544260b9f8 (patch)
treeb02afd5cf2d1429334f83f7718c8c27f2769339a /third_party/base/numerics/safe_math_impl.h
parent6daeb04d3f61378d46d2543573d87e587dd9e544 (diff)
downloadpdfium-f9f1a5dd73b918d50bcd3a4b461b87544260b9f8.tar.xz
Support compiling pdfium with emscripten.
Bug: chromium:804907 Change-Id: I3562653fbc26d669d1e0a99894a69da032a0349e Reviewed-on: https://pdfium-review.googlesource.com/23810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'third_party/base/numerics/safe_math_impl.h')
-rw-r--r--third_party/base/numerics/safe_math_impl.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/third_party/base/numerics/safe_math_impl.h b/third_party/base/numerics/safe_math_impl.h
index 4bcc67188c..61f18d2b2a 100644
--- a/third_party/base/numerics/safe_math_impl.h
+++ b/third_party/base/numerics/safe_math_impl.h
@@ -44,7 +44,11 @@ struct UnsignedOrFloatForSize<Numeric, false, true> {
};
// Probe for builtin math overflow support on Clang and version check on GCC.
-#if defined(__has_builtin)
+#if defined(EMSCRIPTEN)
+// Emscripten Clang reports that it has the builtins, it may be lowered to an
+// instruction that is unsupported in asm.js
+#define USE_OVERFLOW_BUILTINS (0)
+#elif defined(__has_builtin)
#define USE_OVERFLOW_BUILTINS (__has_builtin(__builtin_add_overflow))
#elif defined(__GNUC__)
#define USE_OVERFLOW_BUILTINS (__GNUC__ >= 5)