190d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber/* 2f71323e297a928af368937089d3ed71239786f86Andreas Huber * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 390d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber * 4f71323e297a928af368937089d3ed71239786f86Andreas Huber * Use of this source code is governed by a BSD-style license 5f71323e297a928af368937089d3ed71239786f86Andreas Huber * that can be found in the LICENSE file in the root of the source 6f71323e297a928af368937089d3ed71239786f86Andreas Huber * tree. An additional intellectual property rights grant can be found 7f71323e297a928af368937089d3ed71239786f86Andreas Huber * in the file PATENTS. All contributing project authors may 8f71323e297a928af368937089d3ed71239786f86Andreas Huber * be found in the AUTHORS file in the root of the source tree. 990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber */ 1090d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 1190d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 122ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#ifndef VPX_VPX_INTEGER_H_ 132ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#define VPX_VPX_INTEGER_H_ 1490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 1590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber/* get ptrdiff_t, size_t, wchar_t, NULL */ 1690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#include <stddef.h> 1790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 18ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#if defined(_MSC_VER) 19ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#define VPX_FORCE_INLINE __forceinline 20ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#define VPX_INLINE __inline 21ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#else 22ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#define VPX_FORCE_INLINE __inline__ __attribute__(always_inline) 23ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian// TODO(jbb): Allow a way to force inline off for older compilers. 24ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#define VPX_INLINE inline 25ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#endif 26ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian 271b362b15af34006e6a11974088a46d42b903418eJohann#if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES) 2890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed char int8_t; 2990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed short int16_t; 3090d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed int int32_t; 3190d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 3290d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned char uint8_t; 3390d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned short uint16_t; 3490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned int uint32_t; 3590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 361b362b15af34006e6a11974088a46d42b903418eJohann#if (defined(_MSC_VER) && (_MSC_VER < 1600)) 3790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed __int64 int64_t; 3890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned __int64 uint64_t; 39ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT64_MAX _I64_MAX 40ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT16_MAX _I16_MAX 41ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT16_MIN _I16_MIN 4290d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif 4390d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 4490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#ifndef _UINTPTR_T_DEFINED 451b362b15af34006e6a11974088a46d42b903418eJohanntypedef size_t uintptr_t; 4690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif 4790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 48f71323e297a928af368937089d3ed71239786f86Andreas Huber#else 49f71323e297a928af368937089d3ed71239786f86Andreas Huber 50f71323e297a928af368937089d3ed71239786f86Andreas Huber/* Most platforms have the C99 standard integer types. */ 51f71323e297a928af368937089d3ed71239786f86Andreas Huber 52f71323e297a928af368937089d3ed71239786f86Andreas Huber#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) 53f71323e297a928af368937089d3ed71239786f86Andreas Huber#define __STDC_FORMAT_MACROS 54f71323e297a928af368937089d3ed71239786f86Andreas Huber#endif 55f71323e297a928af368937089d3ed71239786f86Andreas Huber#include <stdint.h> 56f71323e297a928af368937089d3ed71239786f86Andreas Huber 5790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif 5890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 591b362b15af34006e6a11974088a46d42b903418eJohann/* VS2010 defines stdint.h, but not inttypes.h */ 602ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#if defined(_MSC_VER) && _MSC_VER < 1800 611b362b15af34006e6a11974088a46d42b903418eJohann#define PRId64 "I64d" 621b362b15af34006e6a11974088a46d42b903418eJohann#else 631b362b15af34006e6a11974088a46d42b903418eJohann#include <inttypes.h> 641b362b15af34006e6a11974088a46d42b903418eJohann#endif 651b362b15af34006e6a11974088a46d42b903418eJohann 662ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#endif // VPX_VPX_INTEGER_H_ 67