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

Side by Side Diff: include/core/SkTypes.h

Issue 2007753003: Make Sk32ToBool inline again to silence compiler warning. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 2006 The Android Open Source Project 2 * Copyright 2006 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 #ifndef SkTypes_DEFINED 8 #ifndef SkTypes_DEFINED
9 #define SkTypes_DEFINED 9 #define SkTypes_DEFINED
10 10
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 */ 362 */
363 #define SK_InvalidUniqueID 0 363 #define SK_InvalidUniqueID 0
364 364
365 /**************************************************************************** 365 /****************************************************************************
366 The rest of these only build with C++ 366 The rest of these only build with C++
367 */ 367 */
368 #ifdef __cplusplus 368 #ifdef __cplusplus
369 369
370 /** Faster than SkToBool for integral conditions. Returns 0 or 1 370 /** Faster than SkToBool for integral conditions. Returns 0 or 1
371 */ 371 */
372 static constexpr int Sk32ToBool(uint32_t n) { 372 static inline constexpr int Sk32ToBool(uint32_t n) {
373 return (n | (0-n)) >> 31; 373 return (n | (0-n)) >> 31;
374 } 374 }
375 375
376 /** Generic swap function. Classes with efficient swaps should specialize this f unction to take 376 /** Generic swap function. Classes with efficient swaps should specialize this f unction to take
377 their fast path. This function is used by SkTSort. */ 377 their fast path. This function is used by SkTSort. */
378 template <typename T> inline void SkTSwap(T& a, T& b) { 378 template <typename T> inline void SkTSwap(T& a, T& b) {
379 T c(a); 379 T c(a);
380 a = b; 380 a = b;
381 b = c; 381 b = c;
382 } 382 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 701
702 void* fPtr; 702 void* fPtr;
703 size_t fSize; // can be larger than the requested size (see kReuse) 703 size_t fSize; // can be larger than the requested size (see kReuse)
704 uint32_t fStorage[kSize >> 2]; 704 uint32_t fStorage[kSize >> 2];
705 }; 705 };
706 // Can't guard the constructor because it's a template class. 706 // Can't guard the constructor because it's a template class.
707 707
708 #endif /* C++ */ 708 #endif /* C++ */
709 709
710 #endif 710 #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