diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkEndian.h | 13 | ||||
-rw-r--r-- | include/core/SkTypes.h | 2 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/include/core/SkEndian.h b/include/core/SkEndian.h index d7dd562cf1..3eb67dabfe 100644 --- a/include/core/SkEndian.h +++ b/include/core/SkEndian.h @@ -80,6 +80,19 @@ static inline void SkEndianSwap32s(uint32_t array[], int count) { #define SkEndian_SwapLE32(n) SkEndianSwap32(n) #endif +// When a bytestream is embedded in a 32-bit word, how far we need to +// shift the word to extract each byte from the low 8 bits by anding with 0xff. +#ifdef SK_CPU_LENDIAN + #define SkEndian_Byte0Shift 0 + #define SkEndian_Byte1Shift 8 + #define SkEndian_Byte2Shift 16 + #define SkEndian_Byte3Shift 24 +#else // SK_CPU_BENDIAN + #define SkEndian_Byte0Shift 24 + #define SkEndian_Byte1Shift 16 + #define SkEndian_Byte2Shift 8 + #define SkEndian_Byte3Shift 0 +#endif #endif diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 1ee25b129a..51d8d187c7 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -216,6 +216,8 @@ static inline bool SkIsU16(long x) { */ #define SkAlign4(x) (((x) + 3) >> 2 << 2) +#define SkIsAlign4(x) (((x) & 3) == 0) + typedef uint32_t SkFourByteTag; #define SkSetFourByteTag(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index eb92f09eb7..e961fac805 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -55,7 +55,7 @@ * n is already a multiple of 4 */ #define GrALIGN4(n) SkAlign4(n) -#define GrIsALIGN4(n) (((n) & 3) == 0) +#define GrIsALIGN4(n) SkIsAlign4(n) template <typename T> const T& GrMin(const T& a, const T& b) { return (a < b) ? a : b; |