John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AOM_AOM_INTEGER_H_ |
| 13 | #define AOM_AOM_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) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 19 | #define AOM_FORCE_INLINE __forceinline |
| 20 | #define AOM_INLINE __inline |
Jim Bankoski | 07a6752 | 2014-08-12 16:28:08 -0700 | [diff] [blame] | 21 | #else |
James Zern | 7dec515 | 2016-10-17 12:39:34 -0700 | [diff] [blame] | 22 | #define AOM_FORCE_INLINE __inline__ __attribute__((always_inline)) |
Jim Bankoski | 07a6752 | 2014-08-12 16:28:08 -0700 | [diff] [blame] | 23 | // TODO(jbb): Allow a way to force inline off for older compilers. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 24 | #define AOM_INLINE inline |
Jim Bankoski | 07a6752 | 2014-08-12 16:28:08 -0700 | [diff] [blame] | 25 | #endif |
| 26 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 27 | #if defined(AOM_EMULATE_INTTYPES) |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 28 | typedef signed char int8_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 29 | typedef signed short int16_t; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 30 | typedef signed int int32_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 31 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 32 | typedef unsigned char uint8_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 33 | typedef unsigned short uint16_t; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 34 | typedef unsigned int uint32_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 35 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 36 | #ifndef _UINTPTR_T_DEFINED |
John Koleszar | 83b1d90 | 2012-11-05 12:37:14 -0800 | [diff] [blame] | 37 | typedef size_t uintptr_t; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 38 | #endif |
| 39 | |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 40 | #else |
| 41 | |
| 42 | /* Most platforms have the C99 standard integer types. */ |
| 43 | |
James Zern | c87f32c | 2014-09-30 16:06:23 -0700 | [diff] [blame] | 44 | #if defined(__cplusplus) |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 45 | #if !defined(__STDC_FORMAT_MACROS) |
| 46 | #define __STDC_FORMAT_MACROS |
| 47 | #endif |
| 48 | #if !defined(__STDC_LIMIT_MACROS) |
| 49 | #define __STDC_LIMIT_MACROS |
| 50 | #endif |
James Zern | c87f32c | 2014-09-30 16:06:23 -0700 | [diff] [blame] | 51 | #endif // __cplusplus |
| 52 | |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 53 | #include <stdint.h> |
John Koleszar | 1df0314 | 2010-05-20 14:44:18 -0400 | [diff] [blame] | 54 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 55 | #endif |
| 56 | |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 57 | /* VS2010 defines stdint.h, but not inttypes.h */ |
Tom Finegan | 7320fdd | 2014-02-10 15:30:43 -0800 | [diff] [blame] | 58 | #if defined(_MSC_VER) && _MSC_VER < 1800 |
John Koleszar | 4ead98f | 2011-05-05 10:53:24 -0400 | [diff] [blame] | 59 | #define PRId64 "I64d" |
| 60 | #else |
| 61 | #include <inttypes.h> |
| 62 | #endif |
| 63 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 64 | #endif // AOM_AOM_INTEGER_H_ |