| 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 #include "SkTypes.h" | 10 #include "SkTypes.h" |
| 11 | 11 |
| 12 #ifdef SK_DEBUG | 12 #ifdef SK_DEBUG |
| 13 | 13 |
| 14 int8_t SkToS8(long x) | 14 int8_t SkToS8(intmax_t x) { |
| 15 { | |
| 16 SkASSERT((int8_t)x == x); | 15 SkASSERT((int8_t)x == x); |
| 17 return (int8_t)x; | 16 return (int8_t)x; |
| 18 } | 17 } |
| 19 | 18 |
| 20 uint8_t SkToU8(size_t x) | 19 uint8_t SkToU8(uintmax_t x) { |
| 21 { | |
| 22 SkASSERT((uint8_t)x == x); | 20 SkASSERT((uint8_t)x == x); |
| 23 return (uint8_t)x; | 21 return (uint8_t)x; |
| 24 } | 22 } |
| 25 | 23 |
| 26 int16_t SkToS16(long x) | 24 int16_t SkToS16(intmax_t x) { |
| 27 { | |
| 28 SkASSERT((int16_t)x == x); | 25 SkASSERT((int16_t)x == x); |
| 29 return (int16_t)x; | 26 return (int16_t)x; |
| 30 } | 27 } |
| 31 | 28 |
| 32 uint16_t SkToU16(size_t x) | 29 uint16_t SkToU16(uintmax_t x) { |
| 33 { | |
| 34 SkASSERT((uint16_t)x == x); | 30 SkASSERT((uint16_t)x == x); |
| 35 return (uint16_t)x; | 31 return (uint16_t)x; |
| 36 } | 32 } |
| 37 | 33 |
| 38 int32_t SkToS32(long x) | 34 int32_t SkToS32(intmax_t x) { |
| 39 { | |
| 40 SkASSERT((int32_t)x == x); | 35 SkASSERT((int32_t)x == x); |
| 41 return (int32_t)x; | 36 return (int32_t)x; |
| 42 } | 37 } |
| 43 | 38 |
| 44 uint32_t SkToU32(size_t x) | 39 uint32_t SkToU32(uintmax_t x) { |
| 45 { | |
| 46 SkASSERT((uint32_t)x == x); | 40 SkASSERT((uint32_t)x == x); |
| 47 return (uint32_t)x; | 41 return (uint32_t)x; |
| 48 } | 42 } |
| 49 | 43 |
| 50 #endif | 44 #endif |
| OLD | NEW |