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 SkFixed_DEFINED | 10 #ifndef SkFixed_DEFINED |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 (void)SkFixedSinCos(radians, &cosValue); | 111 (void)SkFixedSinCos(radians, &cosValue); |
112 return cosValue; | 112 return cosValue; |
113 } | 113 } |
114 | 114 |
115 ////////////////////////////////////////////////////////////////////////////////
////////////////////// | 115 ////////////////////////////////////////////////////////////////////////////////
////////////////////// |
116 // Now look for ASM overrides for our portable versions (should consider putting
this in its own file) | 116 // Now look for ASM overrides for our portable versions (should consider putting
this in its own file) |
117 | 117 |
118 #ifdef SkLONGLONG | 118 #ifdef SkLONGLONG |
119 inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) | 119 inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) |
120 { | 120 { |
121 return (SkFixed)((int64_t)a * b >> 16); | 121 return (SkFixed)((SkLONGLONG)a * b >> 16); |
122 } | 122 } |
123 inline SkFixed SkFixedSquare_longlong(SkFixed value) | 123 inline SkFixed SkFixedSquare_longlong(SkFixed value) |
124 { | 124 { |
125 return (SkFixed)((int64_t)value * value >> 16); | 125 return (SkFixed)((SkLONGLONG)value * value >> 16); |
126 } | 126 } |
127 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) | 127 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) |
128 #define SkFixedSquare(a) SkFixedSquare_longlong(a) | 128 #define SkFixedSquare(a) SkFixedSquare_longlong(a) |
129 #endif | 129 #endif |
130 | 130 |
131 #if defined(SK_CPU_ARM) | 131 #if defined(SK_CPU_ARM) |
132 /* This guy does not handle NaN or other obscurities, but is faster than | 132 /* This guy does not handle NaN or other obscurities, but is faster than |
133 than (int)(x*65536) | 133 than (int)(x*65536) |
134 */ | 134 */ |
135 inline SkFixed SkFloatToFixed_arm(float x) | 135 inline SkFixed SkFloatToFixed_arm(float x) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 #define SkIntToFixed48(x) ((SkFixed48)(x) << 48) | 179 #define SkIntToFixed48(x) ((SkFixed48)(x) << 48) |
180 #define SkFixed48ToInt(x) ((int)((x) >> 48)) | 180 #define SkFixed48ToInt(x) ((int)((x) >> 48)) |
181 #define SkFixedToFixed48(x) ((SkFixed48)(x) << 32) | 181 #define SkFixedToFixed48(x) ((SkFixed48)(x) << 32) |
182 #define SkFixed48ToFixed(x) ((SkFixed)((x) >> 32)) | 182 #define SkFixed48ToFixed(x) ((SkFixed)((x) >> 32)) |
183 #define SkFloatToFixed48(x) ((SkFixed48)((x) * (65536.0f * 65536.0f * 65536.
0f))) | 183 #define SkFloatToFixed48(x) ((SkFixed48)((x) * (65536.0f * 65536.0f * 65536.
0f))) |
184 | 184 |
185 #define SkScalarToFixed48(x) SkFloatToFixed48(x) | 185 #define SkScalarToFixed48(x) SkFloatToFixed48(x) |
186 | 186 |
187 #endif | 187 #endif |
OLD | NEW |