OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 #ifndef SkTypes_DEFINED | 10 #ifndef SkTypes_DEFINED |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 The rest of these only build with C++ | 269 The rest of these only build with C++ |
270 */ | 270 */ |
271 #ifdef __cplusplus | 271 #ifdef __cplusplus |
272 | 272 |
273 /** Faster than SkToBool for integral conditions. Returns 0 or 1 | 273 /** Faster than SkToBool for integral conditions. Returns 0 or 1 |
274 */ | 274 */ |
275 static inline int Sk32ToBool(uint32_t n) { | 275 static inline int Sk32ToBool(uint32_t n) { |
276 return (n | (0-n)) >> 31; | 276 return (n | (0-n)) >> 31; |
277 } | 277 } |
278 | 278 |
| 279 /** Generic swap function. Classes with efficient swaps should specialize this f
unction to take |
| 280 their fast path. This function is used by SkTSort. */ |
279 template <typename T> inline void SkTSwap(T& a, T& b) { | 281 template <typename T> inline void SkTSwap(T& a, T& b) { |
280 T c(a); | 282 T c(a); |
281 a = b; | 283 a = b; |
282 b = c; | 284 b = c; |
283 } | 285 } |
284 | 286 |
285 static inline int32_t SkAbs32(int32_t value) { | 287 static inline int32_t SkAbs32(int32_t value) { |
286 #ifdef SK_CPU_HAS_CONDITIONAL_INSTR | 288 #ifdef SK_CPU_HAS_CONDITIONAL_INSTR |
287 if (value < 0) | 289 if (value < 0) |
288 value = -value; | 290 value = -value; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 591 |
590 private: | 592 private: |
591 void* fPtr; | 593 void* fPtr; |
592 size_t fSize; // can be larger than the requested size (see kReuse) | 594 size_t fSize; // can be larger than the requested size (see kReuse) |
593 uint32_t fStorage[(kSize + 3) >> 2]; | 595 uint32_t fStorage[(kSize + 3) >> 2]; |
594 }; | 596 }; |
595 | 597 |
596 #endif /* C++ */ | 598 #endif /* C++ */ |
597 | 599 |
598 #endif | 600 #endif |
OLD | NEW |