blob: 2e8f23f459be26db8accf296002f5c354e1f89f5 [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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 Koleszar0ea50ce2010-05-18 11:58:33 -040010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AOM_AOM_INTEGER_H_
13#define AOM_AOM_INTEGER_H_
John Koleszar0ea50ce2010-05-18 11:58:33 -040014
15/* get ptrdiff_t, size_t, wchar_t, NULL */
16#include <stddef.h>
17
Jim Bankoski07a67522014-08-12 16:28:08 -070018#if defined(_MSC_VER)
Yaowu Xuf883b422016-08-30 14:01:10 -070019#define AOM_FORCE_INLINE __forceinline
20#define AOM_INLINE __inline
Jim Bankoski07a67522014-08-12 16:28:08 -070021#else
James Zern7dec5152016-10-17 12:39:34 -070022#define AOM_FORCE_INLINE __inline__ __attribute__((always_inline))
Jim Bankoski07a67522014-08-12 16:28:08 -070023// TODO(jbb): Allow a way to force inline off for older compilers.
Yaowu Xuf883b422016-08-30 14:01:10 -070024#define AOM_INLINE inline
Jim Bankoski07a67522014-08-12 16:28:08 -070025#endif
26
Yaowu Xuf883b422016-08-30 14:01:10 -070027#if defined(AOM_EMULATE_INTTYPES)
clang-format83a52072016-08-08 20:22:13 -070028typedef signed char int8_t;
John Koleszar0ea50ce2010-05-18 11:58:33 -040029typedef signed short int16_t;
clang-format83a52072016-08-08 20:22:13 -070030typedef signed int int32_t;
John Koleszar0ea50ce2010-05-18 11:58:33 -040031
clang-format83a52072016-08-08 20:22:13 -070032typedef unsigned char uint8_t;
John Koleszar0ea50ce2010-05-18 11:58:33 -040033typedef unsigned short uint16_t;
clang-format83a52072016-08-08 20:22:13 -070034typedef unsigned int uint32_t;
John Koleszar0ea50ce2010-05-18 11:58:33 -040035
John Koleszar0ea50ce2010-05-18 11:58:33 -040036#ifndef _UINTPTR_T_DEFINED
John Koleszar83b1d902012-11-05 12:37:14 -080037typedef size_t uintptr_t;
John Koleszar0ea50ce2010-05-18 11:58:33 -040038#endif
39
John Koleszar1df03142010-05-20 14:44:18 -040040#else
41
42/* Most platforms have the C99 standard integer types. */
43
James Zernc87f32c2014-09-30 16:06:23 -070044#if defined(__cplusplus)
clang-format83a52072016-08-08 20:22:13 -070045#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 Zernc87f32c2014-09-30 16:06:23 -070051#endif // __cplusplus
52
John Koleszar1df03142010-05-20 14:44:18 -040053#include <stdint.h>
John Koleszar1df03142010-05-20 14:44:18 -040054
John Koleszar0ea50ce2010-05-18 11:58:33 -040055#endif
56
John Koleszar4ead98f2011-05-05 10:53:24 -040057/* VS2010 defines stdint.h, but not inttypes.h */
Tom Finegan7320fdd2014-02-10 15:30:43 -080058#if defined(_MSC_VER) && _MSC_VER < 1800
John Koleszar4ead98f2011-05-05 10:53:24 -040059#define PRId64 "I64d"
60#else
61#include <inttypes.h>
62#endif
63
Yaowu Xuf883b422016-08-30 14:01:10 -070064#endif // AOM_AOM_INTEGER_H_