| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkMathPriv.h" | 8 #include "SkMathPriv.h" |
| 9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
| 10 #include "SkFloatingPoint.h" | 10 #include "SkFloatingPoint.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 if (x & 0xC) { | 36 if (x & 0xC) { |
| 37 sub_shift(zeros, x, 2); | 37 sub_shift(zeros, x, 2); |
| 38 } | 38 } |
| 39 if (x & 0x2) { | 39 if (x & 0x2) { |
| 40 sub_shift(zeros, x, 1); | 40 sub_shift(zeros, x, 1); |
| 41 } | 41 } |
| 42 | 42 |
| 43 return zeros; | 43 return zeros; |
| 44 } | 44 } |
| 45 | 45 |
| 46 int32_t SkMulDiv(int32_t numer1, int32_t numer2, int32_t denom) { | |
| 47 SkASSERT(denom); | |
| 48 | |
| 49 int64_t tmp = sk_64_mul(numer1, numer2) / denom; | |
| 50 return sk_64_asS32(tmp); | |
| 51 } | |
| 52 | |
| 53 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { | 46 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { |
| 54 #if defined(SkLONGLONG) | 47 #if defined(SkLONGLONG) |
| 55 return static_cast<SkFixed>((int64_t)a * b >> 16); | 48 return static_cast<SkFixed>((int64_t)a * b >> 16); |
| 56 #else | 49 #else |
| 57 int sa = SkExtractSign(a); | 50 int sa = SkExtractSign(a); |
| 58 int sb = SkExtractSign(b); | 51 int sb = SkExtractSign(b); |
| 59 // now make them positive | 52 // now make them positive |
| 60 a = SkApplySign(a, sa); | 53 a = SkApplySign(a, sa); |
| 61 b = SkApplySign(b, sb); | 54 b = SkApplySign(b, sb); |
| 62 | 55 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 int diff = cos2 + sin2 - SK_Fixed1; | 280 int diff = cos2 + sin2 - SK_Fixed1; |
| 288 SkASSERT(SkAbs32(diff) <= 7); | 281 SkASSERT(SkAbs32(diff) <= 7); |
| 289 } | 282 } |
| 290 #endif | 283 #endif |
| 291 | 284 |
| 292 if (cosValuePtr) { | 285 if (cosValuePtr) { |
| 293 *cosValuePtr = cosValue; | 286 *cosValuePtr = cosValue; |
| 294 } | 287 } |
| 295 return sinValue; | 288 return sinValue; |
| 296 } | 289 } |
| OLD | NEW |