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

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

Issue 119353003: Revert "Revert "begin to remove SkLONGLONG and wean Skia off of Sk64"" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « src/core/Sk64.cpp ('k') | tests/BitmapCopyTest.cpp » ('j') | 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 "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
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>((SkLONGLONG)a * b >> 16); 58 return static_cast<SkFixed>((int64_t)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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 int diff = cos2 + sin2 - SK_Fixed1; 290 int diff = cos2 + sin2 - SK_Fixed1;
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 }
OLDNEW
« no previous file with comments | « src/core/Sk64.cpp ('k') | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698