We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
isnan
1 parent 3a2ed1c commit 21e1846Copy full SHA for 21e1846
modules/wechat_qrcode/src/zxing/zxing.hpp
@@ -54,8 +54,14 @@ typedef unsigned char boolean;
54
#include <cmath>
55
56
namespace zxing {
57
-inline bool isnan(float v) { return std::isnan(v); }
58
-inline bool isnan(double v) { return std::isnan(v); }
+inline bool isnan(float v) {
+ union { float v; uint32_t x; } u = { v };
59
+ return (u.x & 0x7fffffffu) > 0x7f800000u;
60
+}
61
+inline bool isnan(double v) {
62
+ union { double v; uint64_t x; } u = { v };
63
+ return (u.x & ~0x8000000000000000uLL) > 0x7ff0000000000000uLL;
64
65
inline float nan() { return std::numeric_limits<float>::quiet_NaN(); }
66
} // namespace zxing
67
0 commit comments