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 40da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#define INT32_MAX _I32_MAX 41da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#define INT32_MIN _I32_MIN 42ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT16_MAX _I16_MAX 43ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT16_MIN _I16_MIN 4490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif 4590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 4690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#ifndef _UINTPTR_T_DEFINED 471b362b15af34006e6a11974088a46d42b903418eJohanntypedef size_t uintptr_t; 4890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif 4990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 50f71323e297a928af368937089d3ed71239786f86Andreas Huber#else 51f71323e297a928af368937089d3ed71239786f86Andreas Huber 52f71323e297a928af368937089d3ed71239786f86Andreas Huber/* Most platforms have the C99 standard integer types. */ 53f71323e297a928af368937089d3ed71239786f86Andreas Huber 54da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#if defined(__cplusplus) 55da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian# if !defined(__STDC_FORMAT_MACROS) 56da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian# define __STDC_FORMAT_MACROS 57da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian# endif 58da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian# if !defined(__STDC_LIMIT_MACROS) 59da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian# define __STDC_LIMIT_MACROS 60da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian# endif 61da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#endif // __cplusplus 62da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian 63f71323e297a928af368937089d3ed71239786f86Andreas Huber#include <stdint.h> 64f71323e297a928af368937089d3ed71239786f86Andreas Huber 6590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif 6690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber 671b362b15af34006e6a11974088a46d42b903418eJohann/* VS2010 defines stdint.h, but not inttypes.h */ 682ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#if defined(_MSC_VER) && _MSC_VER < 1800 691b362b15af34006e6a11974088a46d42b903418eJohann#define PRId64 "I64d" 701b362b15af34006e6a11974088a46d42b903418eJohann#else 711b362b15af34006e6a11974088a46d42b903418eJohann#include <inttypes.h> 721b362b15af34006e6a11974088a46d42b903418eJohann#endif 731b362b15af34006e6a11974088a46d42b903418eJohann 742ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#endif // VPX_VPX_INTEGER_H_ 75