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

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

Issue 1203533003: Clarify iOS flush-to-zero status. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use 'defined' for consistency. Created 5 years, 6 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 13 #if defined(SK_BUILD_FOR_IOS) && (defined(SK_BUILD_FOR_ARM32) || defined(SK_BUIL D_FOR_ARM64))
14 // The iOS ARM processor discards small denormalized numbers to go faster. 14 // iOS on ARM starts processes with the Flush-To-Zero (FTZ) and
15 // Denormals-Are-Zero (DAZ) bits in the fpscr register set.
15 // Algorithms that rely on denormalized numbers need alternative implementations . 16 // Algorithms that rely on denormalized numbers need alternative implementations .
16 #define SK_DISCARD_DENORMALIZED_FOR_SPEED 17 // This can also be controlled in SSE with the MXCSR register,
18 // x87 with FSTCW/FLDCW, and mips with FCSR. This should be detected at runtime,
19 // or the library built one way or the other more generally (by the build).
20 #define SK_CPU_FLUSH_TO_ZERO
17 #endif 21 #endif
18 22
19 /** Returns -1 if n < 0, else returns 0 23 /** Returns -1 if n < 0, else returns 0
20 */ 24 */
21 #define SkExtractSign(n) ((int32_t)(n) >> 31) 25 #define SkExtractSign(n) ((int32_t)(n) >> 31)
22 26
23 /** If sign == -1, returns -n, else sign must be 0, and returns n. 27 /** If sign == -1, returns -n, else sign must be 0, and returns n.
24 Typically used in conjunction with SkExtractSign(). 28 Typically used in conjunction with SkExtractSign().
25 */ 29 */
26 static inline int32_t SkApplySign(int32_t n, int32_t sign) { 30 static inline int32_t SkApplySign(int32_t n, int32_t sign) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 72 }
69 73
70 /** Just the rounding step in SkDiv255Round: round(value / 255) 74 /** Just the rounding step in SkDiv255Round: round(value / 255)
71 */ 75 */
72 static inline unsigned SkDiv255Round(unsigned prod) { 76 static inline unsigned SkDiv255Round(unsigned prod) {
73 prod += 128; 77 prod += 128;
74 return (prod + (prod >> 8)) >> 8; 78 return (prod + (prod >> 8)) >> 8;
75 } 79 }
76 80
77 #endif 81 #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