Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: src/core/SkMath.cpp

Issue 18539004: ARM Skia NEON patches - 04 - Clean SkFixed / SkLONGLONG (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 } 125 }
126 126
127 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { 127 SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) {
128 #if 0 128 #if 0
129 Sk64 tmp; 129 Sk64 tmp;
130 130
131 tmp.setMul(a, b); 131 tmp.setMul(a, b);
132 tmp.shiftRight(16); 132 tmp.shiftRight(16);
133 return tmp.fLo; 133 return tmp.fLo;
134 #elif defined(SkLONGLONG)
djsollen 2013/07/15 12:16:12 in include/core/SkPostConfig.h we define SkLONGLON
kevin.petit.not.used.account 2013/07/15 13:51:24 Yes but in this case, and unless I've missed somet
135 return static_cast<SkFixed>((SkLONGLONG)a * b >> 16);
136 #else 134 #else
137 int sa = SkExtractSign(a); 135 int sa = SkExtractSign(a);
138 int sb = SkExtractSign(b); 136 int sb = SkExtractSign(b);
139 // now make them positive 137 // now make them positive
140 a = SkApplySign(a, sa); 138 a = SkApplySign(a, sa);
141 b = SkApplySign(b, sb); 139 b = SkApplySign(b, sb);
142 140
143 uint32_t ah = a >> 16; 141 uint32_t ah = a >> 16;
144 uint32_t al = a & 0xFFFF; 142 uint32_t al = a & 0xFFFF;
145 uint32_t bh = b >> 16; 143 uint32_t bh = b >> 16;
146 uint32_t bl = b & 0xFFFF; 144 uint32_t bl = b & 0xFFFF;
147 145
148 uint32_t R = ah * b + al * bh + (al * bl >> 16); 146 uint32_t R = ah * b + al * bh + (al * bl >> 16);
149 147
150 return SkApplySign(R, sa ^ sb); 148 return SkApplySign(R, sa ^ sb);
151 #endif 149 #endif
152 } 150 }
153 151
154 SkFract SkFractMul_portable(SkFract a, SkFract b) { 152 SkFract SkFractMul_portable(SkFract a, SkFract b) {
155 #if 0 153 #if 0
156 Sk64 tmp; 154 Sk64 tmp;
157 tmp.setMul(a, b); 155 tmp.setMul(a, b);
158 return tmp.getFract(); 156 return tmp.getFract();
159 #elif defined(SkLONGLONG)
160 return static_cast<SkFract>((SkLONGLONG)a * b >> 30);
161 #else 157 #else
162 int sa = SkExtractSign(a); 158 int sa = SkExtractSign(a);
163 int sb = SkExtractSign(b); 159 int sb = SkExtractSign(b);
164 // now make them positive 160 // now make them positive
165 a = SkApplySign(a, sa); 161 a = SkApplySign(a, sa);
166 b = SkApplySign(b, sb); 162 b = SkApplySign(b, sb);
167 163
168 uint32_t ah = a >> 16; 164 uint32_t ah = a >> 16;
169 uint32_t al = a & 0xFFFF; 165 uint32_t al = a & 0xFFFF;
170 uint32_t bh = b >> 16; 166 uint32_t bh = b >> 16;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 523 }
528 524
529 /////////////////////////////////////////////////////////////////////////////// 525 ///////////////////////////////////////////////////////////////////////////////
530 526
531 SkFixed SkFixedTan(SkFixed radians) { return SkCordicTan(radians); } 527 SkFixed SkFixedTan(SkFixed radians) { return SkCordicTan(radians); }
532 SkFixed SkFixedASin(SkFixed x) { return SkCordicASin(x); } 528 SkFixed SkFixedASin(SkFixed x) { return SkCordicASin(x); }
533 SkFixed SkFixedACos(SkFixed x) { return SkCordicACos(x); } 529 SkFixed SkFixedACos(SkFixed x) { return SkCordicACos(x); }
534 SkFixed SkFixedATan2(SkFixed y, SkFixed x) { return SkCordicATan2(y, x); } 530 SkFixed SkFixedATan2(SkFixed y, SkFixed x) { return SkCordicATan2(y, x); }
535 SkFixed SkFixedExp(SkFixed x) { return SkCordicExp(x); } 531 SkFixed SkFixedExp(SkFixed x) { return SkCordicExp(x); }
536 SkFixed SkFixedLog(SkFixed x) { return SkCordicLog(x); } 532 SkFixed SkFixedLog(SkFixed x) { return SkCordicLog(x); }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698