OLD | NEW |
---|---|
1 /************************************************************************** | 1 /************************************************************************** |
2 * | 2 * |
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. | 3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
4 * All Rights Reserved. | 4 * All Rights Reserved. |
5 * | 5 * |
6 **************************************************************************/ | 6 **************************************************************************/ |
7 | 7 |
8 | 8 |
9 /** | 9 /** |
10 * Code to implement GL_OES_query_matrix. See the spec at: | 10 * Code to implement GL_OES_query_matrix. See the spec at: |
(...skipping 19 matching lines...) Expand all Loading... | |
30 * word which is zero if all the components are valid. If | 30 * word which is zero if all the components are valid. If |
31 * status & (1<<i) != 0, the component i is invalid (e.g., NaN, Inf). | 31 * status & (1<<i) != 0, the component i is invalid (e.g., NaN, Inf). |
32 * The implementations are not required to keep track of overflows. In | 32 * The implementations are not required to keep track of overflows. In |
33 * that case, the invalid bits are never set. | 33 * that case, the invalid bits are never set. |
34 */ | 34 */ |
35 | 35 |
36 #define INT_TO_FIXED(x) ((GLfixed) ((x) << 16)) | 36 #define INT_TO_FIXED(x) ((GLfixed) ((x) << 16)) |
37 #define FLOAT_TO_FIXED(x) ((GLfixed) ((x) * 65536.0)) | 37 #define FLOAT_TO_FIXED(x) ((GLfixed) ((x) * 65536.0)) |
38 | 38 |
39 #if defined(_MSC_VER) | 39 #if defined(_MSC_VER) |
40 #if _MSC_VER < 1800 // Not required on VS2013 and above. | |
marcheu
2013/10/21 23:20:18
Please use C-style /* ... */ comments, there are o
scottmg
2013/10/21 23:23:24
Done.
| |
40 /* Oddly, the fpclassify() function doesn't exist in such a form | 41 /* Oddly, the fpclassify() function doesn't exist in such a form |
41 * on MSVC. This is an implementation using slightly different | 42 * on MSVC. This is an implementation using slightly different |
42 * lower-level Windows functions. | 43 * lower-level Windows functions. |
43 */ | 44 */ |
44 #include <float.h> | 45 #include <float.h> |
45 | 46 |
46 enum {FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL} | 47 enum {FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL} |
47 fpclassify(double x) | 48 fpclassify(double x) |
48 { | 49 { |
49 switch(_fpclass(x)) { | 50 switch(_fpclass(x)) { |
(...skipping 12 matching lines...) Expand all Loading... | |
62 case _FPCLASS_NZ: /* negative zero */ | 63 case _FPCLASS_NZ: /* negative zero */ |
63 case _FPCLASS_PZ: /* positive zero */ | 64 case _FPCLASS_PZ: /* positive zero */ |
64 return FP_ZERO; | 65 return FP_ZERO; |
65 default: | 66 default: |
66 /* Should never get here; but if we do, this will guarantee | 67 /* Should never get here; but if we do, this will guarantee |
67 * that the pattern is not treated like a number. | 68 * that the pattern is not treated like a number. |
68 */ | 69 */ |
69 return FP_NAN; | 70 return FP_NAN; |
70 } | 71 } |
71 } | 72 } |
73 #endif // _MSC_VER < 1800 | |
72 | 74 |
73 #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \ | 75 #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \ |
74 defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \ | 76 defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \ |
75 (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \ | 77 (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \ |
76 (defined(__sun) && defined(__GNUC__)) || defined(ANDROID) || defined(__HAIK U__) | 78 (defined(__sun) && defined(__GNUC__)) || defined(ANDROID) || defined(__HAIK U__) |
77 | 79 |
78 /* fpclassify is available. */ | 80 /* fpclassify is available. */ |
79 | 81 |
80 #elif !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600 | 82 #elif !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600 |
81 | 83 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 exponent[i] = (GLint) 0; | 205 exponent[i] = (GLint) 0; |
204 rv |= bit; | 206 rv |= bit; |
205 break; | 207 break; |
206 } | 208 } |
207 | 209 |
208 } /* for each component */ | 210 } /* for each component */ |
209 | 211 |
210 /* All done */ | 212 /* All done */ |
211 return rv; | 213 return rv; |
212 } | 214 } |
OLD | NEW |