OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkFloatingPoint_DEFINED | 10 #ifndef SkFloatingPoint_DEFINED |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 static inline int sk_float_isinf(float x) { | 70 static inline int sk_float_isinf(float x) { |
71 int32_t bits = SkFloat2Bits(x); | 71 int32_t bits = SkFloat2Bits(x); |
72 return (bits << 1) == (0xFF << 24); | 72 return (bits << 1) == (0xFF << 24); |
73 } | 73 } |
74 #else | 74 #else |
75 #define sk_float_isfinite(x) isfinite(x) | 75 #define sk_float_isfinite(x) isfinite(x) |
76 #define sk_float_isnan(x) isnan(x) | 76 #define sk_float_isnan(x) isnan(x) |
77 #define sk_float_isinf(x) isinf(x) | 77 #define sk_float_isinf(x) isinf(x) |
78 #endif | 78 #endif |
79 | 79 |
| 80 #define sk_double_isnan(a) sk_float_isnan(a) |
| 81 |
80 #ifdef SK_USE_FLOATBITS | 82 #ifdef SK_USE_FLOATBITS |
81 #define sk_float_floor2int(x) SkFloatToIntFloor(x) | 83 #define sk_float_floor2int(x) SkFloatToIntFloor(x) |
82 #define sk_float_round2int(x) SkFloatToIntRound(x) | 84 #define sk_float_round2int(x) SkFloatToIntRound(x) |
83 #define sk_float_ceil2int(x) SkFloatToIntCeil(x) | 85 #define sk_float_ceil2int(x) SkFloatToIntCeil(x) |
84 #else | 86 #else |
85 #define sk_float_floor2int(x) (int)sk_float_floor(x) | 87 #define sk_float_floor2int(x) (int)sk_float_floor(x) |
86 #define sk_float_round2int(x) (int)sk_float_floor((x) + 0.5f) | 88 #define sk_float_round2int(x) (int)sk_float_floor((x) + 0.5f) |
87 #define sk_float_ceil2int(x) (int)sk_float_ceil(x) | 89 #define sk_float_ceil2int(x) (int)sk_float_ceil(x) |
88 #endif | 90 #endif |
89 | 91 |
90 extern const uint32_t gIEEENotANumber; | 92 extern const uint32_t gIEEENotANumber; |
91 extern const uint32_t gIEEEInfinity; | 93 extern const uint32_t gIEEEInfinity; |
92 extern const uint32_t gIEEENegativeInfinity; | 94 extern const uint32_t gIEEENegativeInfinity; |
93 | 95 |
94 #define SK_FloatNaN (*SkTCast<const float*>(&gIEEENotANumber)) | 96 #define SK_FloatNaN (*SkTCast<const float*>(&gIEEENotANumber)) |
95 #define SK_FloatInfinity (*SkTCast<const float*>(&gIEEEInfinity)) | 97 #define SK_FloatInfinity (*SkTCast<const float*>(&gIEEEInfinity)) |
96 #define SK_FloatNegativeInfinity (*SkTCast<const float*>(&gIEEENegativeInfini
ty)) | 98 #define SK_FloatNegativeInfinity (*SkTCast<const float*>(&gIEEENegativeInfini
ty)) |
97 #endif | 99 #endif |
OLD | NEW |