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

Side by Side Diff: include/gpu/GrTypes.h

Issue 318873002: Remove GrIsPow2 in favor of SkIsPow2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « include/gpu/GrTexture.h ('k') | src/gpu/GrContext.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 static inline uint32_t GrUIAlignDown(uint32_t x, uint32_t alignment) { 144 static inline uint32_t GrUIAlignDown(uint32_t x, uint32_t alignment) {
145 return (x / alignment) * alignment; 145 return (x / alignment) * alignment;
146 } 146 }
147 static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) { 147 static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) {
148 return (x / alignment) * alignment; 148 return (x / alignment) * alignment;
149 } 149 }
150 150
151 /////////////////////////////////////////////////////////////////////////////// 151 ///////////////////////////////////////////////////////////////////////////////
152 152
153 /** 153 /**
154 * Return true if n is a power of 2
155 */
156 static inline bool GrIsPow2(unsigned n) {
157 return n && 0 == (n & (n - 1));
scroggo 2014/06/09 14:40:56 Not sure whether it makes a difference to any of t
158 }
159
160 /**
161 * Return the next power of 2 >= n. 154 * Return the next power of 2 >= n.
162 */ 155 */
163 static inline uint32_t GrNextPow2(uint32_t n) { 156 static inline uint32_t GrNextPow2(uint32_t n) {
164 return n ? (1 << (32 - SkCLZ(n - 1))) : 1; 157 return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
165 } 158 }
166 159
167 static inline int GrNextPow2(int n) { 160 static inline int GrNextPow2(int n) {
168 SkASSERT(n >= 0); // this impl only works for non-neg. 161 SkASSERT(n >= 0); // this impl only works for non-neg.
169 return n ? (1 << (32 - SkCLZ(n - 1))) : 1; 162 return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
170 } 163 }
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 654 }
662 655
663 /** 656 /**
664 * This value translates to reseting all the context state for any backend. 657 * This value translates to reseting all the context state for any backend.
665 */ 658 */
666 static const uint32_t kAll_GrBackendState = 0xffffffff; 659 static const uint32_t kAll_GrBackendState = 0xffffffff;
667 660
668 /////////////////////////////////////////////////////////////////////////////// 661 ///////////////////////////////////////////////////////////////////////////////
669 662
670 #endif 663 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTexture.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698