File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 31
31
#include < float.h> // float limits
32
32
#include < math.h> // infinity
33
33
34
+ // Windows does not define INFINITY in math.h
35
+ // Copy V8's approach and use HUGE_VAL instead
36
+ #ifndef INFINITY
37
+ # ifdef HUGE_VALF
38
+ # define INFINITY HUGE_VALF
39
+ # else
40
+
41
+ // MSVC. No INFINITY, no HUGE_VALF
42
+ // There's HUGE_VAL, but that's a double, not a float.
43
+ // Assign the bytes and float-ify it.
44
+
45
+ typedef union { unsigned char __c[4 ]; float __f; } __huge_valf_t ;
46
+ # if __BYTE_ORDER == __BIG_ENDIAN
47
+ # define __HUGE_VALF_bytes { 0x7f , 0x80 , 0 , 0 }
48
+ # endif
49
+ # if __BYTE_ORDER == __LITTLE_ENDIAN
50
+ # define __HUGE_VALF_bytes { 0 , 0 , 0x80 , 0x7f }
51
+ # endif
52
+ static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
53
+ # define INFINITY (__huge_valf.__f)
54
+
55
+ # endif
56
+ #endif
57
+
34
58
#define MIN (a,b ) ((a) < (b) ? (a) : (b))
35
59
36
60
#define BUFFER_CLASS_ID (0xBABE )
You can’t perform that action at this time.
0 commit comments