OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 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 SkFloatBits_DEFINED | 10 #ifndef SkFloatBits_DEFINED |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 /** Return the 2s compliment int as a float. This undos the result of | 88 /** Return the 2s compliment int as a float. This undos the result of |
89 SkFloatAs2sCompliment | 89 SkFloatAs2sCompliment |
90 */ | 90 */ |
91 static inline float Sk2sComplimentAsFloat(int32_t x) { | 91 static inline float Sk2sComplimentAsFloat(int32_t x) { |
92 return SkBits2Float(Sk2sComplimentToSignBit(x)); | 92 return SkBits2Float(Sk2sComplimentToSignBit(x)); |
93 } | 93 } |
94 | 94 |
95 /** Return x cast to a float (i.e. (float)x) | 95 /** Return x cast to a float (i.e. (float)x) |
96 */ | 96 */ |
97 float SkIntToFloatCast(int x); | 97 float SkIntToFloatCast(int x); |
98 float SkIntToFloatCast_NoOverflowCheck(int x); | |
99 | 98 |
100 /** Return the float cast to an int. | 99 /** Return the float cast to an int. |
101 If the value is out of range, or NaN, return +/- SK_MaxS32 | 100 If the value is out of range, or NaN, return +/- SK_MaxS32 |
102 */ | 101 */ |
103 static inline int32_t SkFloatToIntCast(float x) { | 102 static inline int32_t SkFloatToIntCast(float x) { |
104 return SkFloatBits_toIntCast(SkFloat2Bits(x)); | 103 return SkFloatBits_toIntCast(SkFloat2Bits(x)); |
105 } | 104 } |
106 | 105 |
107 /** Return the floor of the float as an int. | 106 /** Return the floor of the float as an int. |
108 If the value is out of range, or NaN, return +/- SK_MaxS32 | 107 If the value is out of range, or NaN, return +/- SK_MaxS32 |
(...skipping 15 matching lines...) Expand all Loading... |
124 static inline int32_t SkFloatToIntCeil(float x) { | 123 static inline int32_t SkFloatToIntCeil(float x) { |
125 return SkFloatBits_toIntCeil(SkFloat2Bits(x)); | 124 return SkFloatBits_toIntCeil(SkFloat2Bits(x)); |
126 } | 125 } |
127 | 126 |
128 // Scalar wrappers for float-bit routines | 127 // Scalar wrappers for float-bit routines |
129 | 128 |
130 #define SkScalarAs2sCompliment(x) SkFloatAs2sCompliment(x) | 129 #define SkScalarAs2sCompliment(x) SkFloatAs2sCompliment(x) |
131 #define Sk2sComplimentAsScalar(x) Sk2sComplimentAsFloat(x) | 130 #define Sk2sComplimentAsScalar(x) Sk2sComplimentAsFloat(x) |
132 | 131 |
133 #endif | 132 #endif |
OLD | NEW |