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 | |
James Zern | 7386bde | 2013-12-15 18:26:15 -0800 | [diff] [blame] | 12 | #ifndef VPX_VPX_INTEGER_H_ |
| 13 | #define VPX_VPX_INTEGER_H_ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 14 | |
| 15 | /* get ptrdiff_t, size_t, wchar_t, NULL */ |
| 16 | #include <stddef.h> |
| 17 | |
Jim Bankoski | 07a6752 | 2014-08-12 16:28:08 -0700 | [diff] [blame] | 18 | #if defined(_MSC_VER) |
| 19 | #define VPX_FORCE_INLINE __forceinline |
| 20 | #define VPX_INLINE __inline |
| 21 | #else |
| 22 | #define VPX_FORCE_INLINE __inline__ __attribute__(always_inline) |
| 23 | // TODO(jbb): Allow a way to force inline off for older compilers. |
| 24 | #define VPX_INLINE inline |
| 25 | #endif |
| 26 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 27 | #if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 28 | typedef signed char int8_t; |
| 29 | typedef signed short int16_t; |
| 30 | typedef signed int int32_t; |
| 31 | |
| 32 | typedef unsigned char uint8_t; |
| 33 | typedef unsigned short uint16_t; |
| 34 | typedef unsigned int uint32_t; |
| 35 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 36 | #if (defined(_MSC_VER) && (_MSC_VER < 1600)) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 37 | typedef signed __int64 int64_t; |
| 38 | typedef unsigned __int64 uint64_t; |
John Koleszar | 24bc1a7 | 2013-01-14 11:49:30 -0800 | [diff] [blame] | 39 | #define INT64_MAX _I64_MAX |
Yaowu Xu | 03bc5a3 | 2015-02-09 16:26:53 -0800 | [diff] [blame] | 40 | #define INT32_MAX _I32_MAX |
| 41 | #define INT32_MIN _I32_MIN |
Yaowu Xu | dea1433 | 2013-02-04 10:16:59 -0800 | [diff] [blame] | 42 | #define INT16_MAX _I16_MAX |
| 43 | #define INT16_MIN _I16_MIN |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 44 | #endif |
| 45 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 46 | #ifndef _UINTPTR_T_DEFINED |
John Koleszar | 83b1d90 | 2012-11-05 12:37:14 -0800 | [diff] [blame] | 47 | typedef size_t uintptr_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 48 | #endif |
| 49 | |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 50 | #else |
| 51 | |
| 52 | /* Most platforms have the C99 standard integer types. */ |
| 53 | |
James Zern | c87f32c | 2014-09-30 16:06:23 -0700 | [diff] [blame] | 54 | #if defined(__cplusplus) |
| 55 | # if !defined(__STDC_FORMAT_MACROS) |
| 56 | # define __STDC_FORMAT_MACROS |
| 57 | # endif |
| 58 | # if !defined(__STDC_LIMIT_MACROS) |
| 59 | # define __STDC_LIMIT_MACROS |
| 60 | # endif |
| 61 | #endif // __cplusplus |
| 62 | |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 63 | #include <stdint.h> |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 64 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 65 | #endif |
| 66 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 67 | /* VS2010 defines stdint.h, but not inttypes.h */ |
Tom Finegan | 7320fdd | 2014-02-10 15:30:43 -0800 | [diff] [blame] | 68 | #if defined(_MSC_VER) && _MSC_VER < 1800 |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 69 | #define PRId64 "I64d" |
| 70 | #else |
| 71 | #include <inttypes.h> |
| 72 | #endif |
| 73 | |
James Zern | 7386bde | 2013-12-15 18:26:15 -0800 | [diff] [blame] | 74 | #endif // VPX_VPX_INTEGER_H_ |