Chromium Code Reviews| 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 "SkCordic.h" | 9 #include "SkCordic.h" |
| 10 #include "SkFloatBits.h" | 10 #include "SkFloatBits.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { | 108 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { |
| 109 #if 0 | 109 #if 0 |
| 110 Sk64 tmp; | 110 Sk64 tmp; |
| 111 | 111 |
| 112 tmp.setMul(a, b); | 112 tmp.setMul(a, b); |
| 113 tmp.shiftRight(16); | 113 tmp.shiftRight(16); |
| 114 return tmp.fLo; | 114 return tmp.fLo; |
| 115 #elif defined(SkLONGLONG) | |
| 116 return static_cast<SkFixed>((SkLONGLONG)a * b >> 16); | |
|
reed1
2013/08/07 13:59:05
You have removed the longlong version. Is that bec
| |
| 117 #else | 115 #else |
| 118 int sa = SkExtractSign(a); | 116 int sa = SkExtractSign(a); |
| 119 int sb = SkExtractSign(b); | 117 int sb = SkExtractSign(b); |
| 120 // now make them positive | 118 // now make them positive |
| 121 a = SkApplySign(a, sa); | 119 a = SkApplySign(a, sa); |
| 122 b = SkApplySign(b, sb); | 120 b = SkApplySign(b, sb); |
| 123 | 121 |
| 124 uint32_t ah = a >> 16; | 122 uint32_t ah = a >> 16; |
| 125 uint32_t al = a & 0xFFFF; | 123 uint32_t al = a & 0xFFFF; |
| 126 uint32_t bh = b >> 16; | 124 uint32_t bh = b >> 16; |
| 127 uint32_t bl = b & 0xFFFF; | 125 uint32_t bl = b & 0xFFFF; |
| 128 | 126 |
| 129 uint32_t R = ah * b + al * bh + (al * bl >> 16); | 127 uint32_t R = ah * b + al * bh + (al * bl >> 16); |
| 130 | 128 |
| 131 return SkApplySign(R, sa ^ sb); | 129 return SkApplySign(R, sa ^ sb); |
| 132 #endif | 130 #endif |
| 133 } | 131 } |
| 134 | 132 |
| 135 SkFract SkFractMul_portable(SkFract a, SkFract b) { | 133 SkFract SkFractMul_portable(SkFract a, SkFract b) { |
| 136 #if 0 | 134 #if 0 |
| 137 Sk64 tmp; | 135 Sk64 tmp; |
| 138 tmp.setMul(a, b); | 136 tmp.setMul(a, b); |
| 139 return tmp.getFract(); | 137 return tmp.getFract(); |
| 140 #elif defined(SkLONGLONG) | |
| 141 return static_cast<SkFract>((SkLONGLONG)a * b >> 30); | |
| 142 #else | 138 #else |
| 143 int sa = SkExtractSign(a); | 139 int sa = SkExtractSign(a); |
| 144 int sb = SkExtractSign(b); | 140 int sb = SkExtractSign(b); |
| 145 // now make them positive | 141 // now make them positive |
| 146 a = SkApplySign(a, sa); | 142 a = SkApplySign(a, sa); |
| 147 b = SkApplySign(b, sb); | 143 b = SkApplySign(b, sb); |
| 148 | 144 |
| 149 uint32_t ah = a >> 16; | 145 uint32_t ah = a >> 16; |
| 150 uint32_t al = a & 0xFFFF; | 146 uint32_t al = a & 0xFFFF; |
| 151 uint32_t bh = b >> 16; | 147 uint32_t bh = b >> 16; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 } | 504 } |
| 509 | 505 |
| 510 /////////////////////////////////////////////////////////////////////////////// | 506 /////////////////////////////////////////////////////////////////////////////// |
| 511 | 507 |
| 512 SkFixed SkFixedTan(SkFixed radians) { return SkCordicTan(radians); } | 508 SkFixed SkFixedTan(SkFixed radians) { return SkCordicTan(radians); } |
| 513 SkFixed SkFixedASin(SkFixed x) { return SkCordicASin(x); } | 509 SkFixed SkFixedASin(SkFixed x) { return SkCordicASin(x); } |
| 514 SkFixed SkFixedACos(SkFixed x) { return SkCordicACos(x); } | 510 SkFixed SkFixedACos(SkFixed x) { return SkCordicACos(x); } |
| 515 SkFixed SkFixedATan2(SkFixed y, SkFixed x) { return SkCordicATan2(y, x); } | 511 SkFixed SkFixedATan2(SkFixed y, SkFixed x) { return SkCordicATan2(y, x); } |
| 516 SkFixed SkFixedExp(SkFixed x) { return SkCordicExp(x); } | 512 SkFixed SkFixedExp(SkFixed x) { return SkCordicExp(x); } |
| 517 SkFixed SkFixedLog(SkFixed x) { return SkCordicLog(x); } | 513 SkFixed SkFixedLog(SkFixed x) { return SkCordicLog(x); } |
| OLD | NEW |