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

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

Issue 1619923002: SkBSwap32 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 11 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 | « 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 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
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 */ 75 */
76 static inline unsigned SkDiv255Round(unsigned prod) { 76 static inline unsigned SkDiv255Round(unsigned prod) {
77 prod += 128; 77 prod += 128;
78 return (prod + (prod >> 8)) >> 8; 78 return (prod + (prod >> 8)) >> 8;
79 } 79 }
80 80
81 static inline float SkPinToUnitFloat(float x) { 81 static inline float SkPinToUnitFloat(float x) {
82 return SkTMin(SkTMax(x, 0.0f), 1.0f); 82 return SkTMin(SkTMax(x, 0.0f), 1.0f);
83 } 83 }
84 84
85 /**
86 * Swap byte order of a 4-byte value, e.g. 0xaarrggbb -> 0xbbggrraa.
87 */
88 #if defined(_MSC_VER)
89 #include <intrin.h>
90 static inline uint32_t SkBSwap32(uint32_t v) { return _byteswap_ulong(v); }
91 #else
92 static inline uint32_t SkBSwap32(uint32_t v) { return __builtin_bswap32(v); }
85 #endif 93 #endif
94
95 #endif
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