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

Side by Side Diff: src/core/SkMathPriv.h

Issue 373383003: ios fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: only build gyp on ios Created 6 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
« no previous file with comments | « src/core/SkFloatBits.cpp ('k') | src/core/SkPoint.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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 #ifndef SkMathPriv_DEFINED 8 #ifndef SkMathPriv_DEFINED
9 #define SkMathPriv_DEFINED 9 #define SkMathPriv_DEFINED
10 10
11 #include "SkMath.h" 11 #include "SkMath.h"
12 12
13 #ifdef SK_BUILD_FOR_IOS
14 // The iOS ARM processor discards small denormalized numbers to go faster.
15 // Algorithms that rely on denormalized numbers need alternative implementations .
16 #define SK_DISCARD_DENORMALIZED_FOR_SPEED
17 #endif
18
13 /** Returns -1 if n < 0, else returns 0 19 /** Returns -1 if n < 0, else returns 0
14 */ 20 */
15 #define SkExtractSign(n) ((int32_t)(n) >> 31) 21 #define SkExtractSign(n) ((int32_t)(n) >> 31)
16 22
17 /** If sign == -1, returns -n, else sign must be 0, and returns n. 23 /** If sign == -1, returns -n, else sign must be 0, and returns n.
18 Typically used in conjunction with SkExtractSign(). 24 Typically used in conjunction with SkExtractSign().
19 */ 25 */
20 static inline int32_t SkApplySign(int32_t n, int32_t sign) { 26 static inline int32_t SkApplySign(int32_t n, int32_t sign) {
21 SkASSERT(sign == 0 || sign == -1); 27 SkASSERT(sign == 0 || sign == -1);
22 return (n ^ sign) - sign; 28 return (n ^ sign) - sign;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 68 }
63 69
64 /** Just the rounding step in SkDiv255Round: round(value / 255) 70 /** Just the rounding step in SkDiv255Round: round(value / 255)
65 */ 71 */
66 static inline unsigned SkDiv255Round(unsigned prod) { 72 static inline unsigned SkDiv255Round(unsigned prod) {
67 prod += 128; 73 prod += 128;
68 return (prod + (prod >> 8)) >> 8; 74 return (prod + (prod >> 8)) >> 8;
69 } 75 }
70 76
71 #endif 77 #endif
OLDNEW
« no previous file with comments | « src/core/SkFloatBits.cpp ('k') | src/core/SkPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698