Skip to content

Commit 8e12dd8

Browse files
committed
Use OpenCV cvInf/cvNan
1 parent a5479bf commit 8e12dd8

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

modules/wechat_qrcode/src/zxing/zxing.hpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef __ZXING_ZXING_HPP__
1212
#define __ZXING_ZXING_HPP__
1313

14+
#include "opencv2/core/fast_math.hpp"
1415

1516
#define COUNTER_TYPE short
1617

@@ -54,14 +55,8 @@ typedef unsigned char boolean;
5455
#include <cmath>
5556

5657
namespace zxing {
57-
inline bool isnan(float v) {
58-
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-
}
58+
inline bool isnan(float v) { return cvIsNaN(v); }
59+
inline bool isnan(double v) { return cvIsNaN(v); }
6560
inline float nan() { return std::numeric_limits<float>::quiet_NaN(); }
6661
} // namespace zxing
6762

0 commit comments

Comments
 (0)