1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #include "SkTypes.h" 11 12 #ifdef SK_DEBUG 13 SkToS8(long x)14int8_t SkToS8(long x) 15 { 16 SkASSERT((int8_t)x == x); 17 return (int8_t)x; 18 } 19 SkToU8(size_t x)20uint8_t SkToU8(size_t x) 21 { 22 SkASSERT((uint8_t)x == x); 23 return (uint8_t)x; 24 } 25 SkToS16(long x)26int16_t SkToS16(long x) 27 { 28 SkASSERT((int16_t)x == x); 29 return (int16_t)x; 30 } 31 SkToU16(size_t x)32uint16_t SkToU16(size_t x) 33 { 34 SkASSERT((uint16_t)x == x); 35 return (uint16_t)x; 36 } 37 SkToS32(long x)38int32_t SkToS32(long x) 39 { 40 SkASSERT((int32_t)x == x); 41 return (int32_t)x; 42 } 43 SkToU32(size_t x)44uint32_t SkToU32(size_t x) 45 { 46 SkASSERT((uint32_t)x == x); 47 return (uint32_t)x; 48 } 49 50 #endif 51 52