fix size_t/int warnings
BUG=skia:
R=mtklein@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/247753003
git-svn-id: http://skia.googlecode.com/svn/trunk@14332 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkEndian.h b/include/core/SkEndian.h
index 6eba297..0955fcc 100644
--- a/include/core/SkEndian.h
+++ b/include/core/SkEndian.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef SkEndian_DEFINED
#define SkEndian_DEFINED
@@ -29,10 +27,10 @@
/** Swap the two bytes in the low 16bits of the parameters.
e.g. 0x1234 -> 0x3412
*/
-static inline uint16_t SkEndianSwap16(U16CPU value) {
- SkASSERT(value == (uint16_t)value);
+static inline uint16_t SkEndianSwap16(uint16_t value) {
return static_cast<uint16_t>((value >> 8) | (value << 8));
}
+
template<uint16_t N> struct SkTEndianSwap16 {
static const uint16_t value = static_cast<uint16_t>((N >> 8) | ((N & 0xFF) << 8));
};
@@ -53,11 +51,12 @@
e.g. 0x12345678 -> 0x78563412
*/
static inline uint32_t SkEndianSwap32(uint32_t value) {
- return ((value & 0xFF) << 24) |
- ((value & 0xFF00) << 8) |
- ((value & 0xFF0000) >> 8) |
+ return ((value & 0xFF) << 24) |
+ ((value & 0xFF00) << 8) |
+ ((value & 0xFF0000) >> 8) |
(value >> 24);
}
+
template<uint32_t N> struct SkTEndianSwap32 {
static const uint32_t value = ((N & 0xFF) << 24) |
((N & 0xFF00) << 8) |