John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 1 | /* |
John Koleszar | c2140b8 | 2010-09-09 08:16:39 -0400 | [diff] [blame] | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 3 | * |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 7 | * in the file PATENTS. All contributing project authors may |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 8 | * be found in the AUTHORS file in the root of the source tree. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | |
| 12 | #ifndef VPX_INTEGER_H |
| 13 | #define VPX_INTEGER_H |
| 14 | |
| 15 | /* get ptrdiff_t, size_t, wchar_t, NULL */ |
| 16 | #include <stddef.h> |
| 17 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 18 | #if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 19 | typedef signed char int8_t; |
| 20 | typedef signed short int16_t; |
| 21 | typedef signed int int32_t; |
| 22 | |
| 23 | typedef unsigned char uint8_t; |
| 24 | typedef unsigned short uint16_t; |
| 25 | typedef unsigned int uint32_t; |
| 26 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 27 | #if (defined(_MSC_VER) && (_MSC_VER < 1600)) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 28 | typedef signed __int64 int64_t; |
| 29 | typedef unsigned __int64 uint64_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | #ifdef HAVE_ARMV6 |
| 33 | typedef unsigned int int_fast16_t; |
| 34 | #else |
| 35 | typedef signed short int_fast16_t; |
| 36 | #endif |
| 37 | typedef signed char int_fast8_t; |
| 38 | typedef unsigned char uint_fast8_t; |
| 39 | |
| 40 | #ifndef _UINTPTR_T_DEFINED |
| 41 | typedef unsigned int uintptr_t; |
| 42 | #endif |
| 43 | |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 44 | #else |
| 45 | |
| 46 | /* Most platforms have the C99 standard integer types. */ |
| 47 | |
| 48 | #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) |
| 49 | #define __STDC_FORMAT_MACROS |
| 50 | #endif |
| 51 | #include <stdint.h> |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 52 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 53 | #endif |
| 54 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 55 | /* VS2010 defines stdint.h, but not inttypes.h */ |
| 56 | #if defined(_MSC_VER) |
| 57 | #define PRId64 "I64d" |
| 58 | #else |
| 59 | #include <inttypes.h> |
| 60 | #endif |
| 61 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 62 | #endif |