diff options
author | Thomas Lively <tlively@google.com> | 2022-12-02 10:18:37 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 08:18:37 -0800 |
commit | e8b41f4a92b8255336888019b5fb6ba014f3c363 (patch) | |
tree | d6981130f856f502c1cd96d6fb7afd83c0f123ed /src/wasm/wat-lexer.cpp | |
parent | ed06104c6f342d14653932b02d5b060654db0d1d (diff) | |
download | binaryen-e8b41f4a92b8255336888019b5fb6ba014f3c363.tar.gz binaryen-e8b41f4a92b8255336888019b5fb6ba014f3c363.tar.bz2 binaryen-e8b41f4a92b8255336888019b5fb6ba014f3c363.zip |
Remove more uses of NAN (#5310)
In favor of the more portable code snippet using `std::copysign`. Also
reintroduce assertions that the NaNs have the expected signs. This continues
work started in #5302.
Diffstat (limited to 'src/wasm/wat-lexer.cpp')
-rw-r--r-- | src/wasm/wat-lexer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wasm/wat-lexer.cpp b/src/wasm/wat-lexer.cpp index befa9f6ab..6d7e9edec 100644 --- a/src/wasm/wat-lexer.cpp +++ b/src/wasm/wat-lexer.cpp @@ -221,6 +221,8 @@ struct LexFloatCtx : LexCtx { std::optional<LexFloatResult> lexed() { const double posNan = std::copysign(NAN, 1.0); const double negNan = std::copysign(NAN, -1.0); + assert(!std::signbit(posNan) && "expected positive NaN to be positive"); + assert(std::signbit(negNan) && "expected negative NaN to be negative"); auto basic = LexCtx::lexed(); if (!basic) { return {}; |