| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 SkASSERT(denom); | 48 SkASSERT(denom); |
| 49 | 49 |
| 50 Sk64 tmp; | 50 Sk64 tmp; |
| 51 tmp.setMul(numer1, numer2); | 51 tmp.setMul(numer1, numer2); |
| 52 tmp.div(denom, Sk64::kTrunc_DivOption); | 52 tmp.div(denom, Sk64::kTrunc_DivOption); |
| 53 return tmp.get32(); | 53 return tmp.get32(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { | 56 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { |
| 57 #if defined(SkLONGLONG) | 57 #if defined(SkLONGLONG) |
| 58 return static_cast<SkFixed>((int64_t)a * b >> 16); | 58 return static_cast<SkFixed>((SkLONGLONG)a * b >> 16); |
| 59 #else | 59 #else |
| 60 int sa = SkExtractSign(a); | 60 int sa = SkExtractSign(a); |
| 61 int sb = SkExtractSign(b); | 61 int sb = SkExtractSign(b); |
| 62 // now make them positive | 62 // now make them positive |
| 63 a = SkApplySign(a, sa); | 63 a = SkApplySign(a, sa); |
| 64 b = SkApplySign(b, sb); | 64 b = SkApplySign(b, sb); |
| 65 | 65 |
| 66 uint32_t ah = a >> 16; | 66 uint32_t ah = a >> 16; |
| 67 uint32_t al = a & 0xFFFF; | 67 uint32_t al = a & 0xFFFF; |
| 68 uint32_t bh = b >> 16; | 68 uint32_t bh = b >> 16; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 SkASSERT(SkAbs32(diff) <= 7); | 291 SkASSERT(SkAbs32(diff) <= 7); |
| 292 } | 292 } |
| 293 #endif | 293 #endif |
| 294 | 294 |
| 295 if (cosValuePtr) { | 295 if (cosValuePtr) { |
| 296 *cosValuePtr = cosValue; | 296 *cosValuePtr = cosValue; |
| 297 } | 297 } |
| 298 return sinValue; | 298 return sinValue; |
| 299 } | 299 } |
| 300 | 300 |
| OLD | NEW |