OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |