vpx_integer.h revision ba164dffc5a6795bce97fae02b51ccf3330e15e4
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
1290d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#ifndef VPX_INTEGER_H
1390d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#define VPX_INTEGER_H
1490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
1590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber/* get ptrdiff_t, size_t, wchar_t, NULL */
1690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#include <stddef.h>
1790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
181b362b15af34006e6a11974088a46d42b903418eJohann#if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES)
1990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed char  int8_t;
2090d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed short int16_t;
2190d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed int   int32_t;
2290d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
2390d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned char  uint8_t;
2490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned short uint16_t;
2590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned int   uint32_t;
2690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
271b362b15af34006e6a11974088a46d42b903418eJohann#if (defined(_MSC_VER) && (_MSC_VER < 1600))
2890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef signed __int64   int64_t;
2990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Hubertypedef unsigned __int64 uint64_t;
30ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT64_MAX _I64_MAX
31ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT16_MAX _I16_MAX
32ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define INT16_MIN _I16_MIN
3390d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif
3490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
3590d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#ifndef _UINTPTR_T_DEFINED
361b362b15af34006e6a11974088a46d42b903418eJohanntypedef size_t uintptr_t;
3790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif
3890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
39f71323e297a928af368937089d3ed71239786f86Andreas Huber#else
40f71323e297a928af368937089d3ed71239786f86Andreas Huber
41f71323e297a928af368937089d3ed71239786f86Andreas Huber/* Most platforms have the C99 standard integer types. */
42f71323e297a928af368937089d3ed71239786f86Andreas Huber
43f71323e297a928af368937089d3ed71239786f86Andreas Huber#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
44f71323e297a928af368937089d3ed71239786f86Andreas Huber#define __STDC_FORMAT_MACROS
45f71323e297a928af368937089d3ed71239786f86Andreas Huber#endif
46f71323e297a928af368937089d3ed71239786f86Andreas Huber#include <stdint.h>
47f71323e297a928af368937089d3ed71239786f86Andreas Huber
4890d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif
4990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
501b362b15af34006e6a11974088a46d42b903418eJohann/* VS2010 defines stdint.h, but not inttypes.h */
511b362b15af34006e6a11974088a46d42b903418eJohann#if defined(_MSC_VER)
521b362b15af34006e6a11974088a46d42b903418eJohann#define PRId64 "I64d"
531b362b15af34006e6a11974088a46d42b903418eJohann#else
541b362b15af34006e6a11974088a46d42b903418eJohann#include <inttypes.h>
551b362b15af34006e6a11974088a46d42b903418eJohann#endif
561b362b15af34006e6a11974088a46d42b903418eJohann
5790d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber#endif
58