blob: 829c9d132c8c16dcd92a5e688e4c524787c143fb [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
10
11
James Zern7386bde2013-12-15 18:26:15 -080012#ifndef VPX_VPX_INTEGER_H_
13#define VPX_VPX_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)
19#define VPX_FORCE_INLINE __forceinline
20#define VPX_INLINE __inline
21#else
22#define VPX_FORCE_INLINE __inline__ __attribute__(always_inline)
23// TODO(jbb): Allow a way to force inline off for older compilers.
24#define VPX_INLINE inline
25#endif
26
John Koleszar4ead98f2011-05-05 10:53:24 -040027#if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES)
John Koleszar0ea50ce2010-05-18 11:58:33 -040028typedef signed char int8_t;
29typedef signed short int16_t;
30typedef signed int int32_t;
31
32typedef unsigned char uint8_t;
33typedef unsigned short uint16_t;
34typedef unsigned int uint32_t;
35
John Koleszar4ead98f2011-05-05 10:53:24 -040036#if (defined(_MSC_VER) && (_MSC_VER < 1600))
John Koleszar0ea50ce2010-05-18 11:58:33 -040037typedef signed __int64 int64_t;
38typedef unsigned __int64 uint64_t;
John Koleszar24bc1a72013-01-14 11:49:30 -080039#define INT64_MAX _I64_MAX
Yaowu Xu03bc5a32015-02-09 16:26:53 -080040#define INT32_MAX _I32_MAX
41#define INT32_MIN _I32_MIN
Yaowu Xudea14332013-02-04 10:16:59 -080042#define INT16_MAX _I16_MAX
43#define INT16_MIN _I16_MIN
John Koleszar0ea50ce2010-05-18 11:58:33 -040044#endif
45
John Koleszar0ea50ce2010-05-18 11:58:33 -040046#ifndef _UINTPTR_T_DEFINED
John Koleszar83b1d902012-11-05 12:37:14 -080047typedef size_t uintptr_t;
John Koleszar0ea50ce2010-05-18 11:58:33 -040048#endif
49
John Koleszar1df03142010-05-20 14:44:18 -040050#else
51
52/* Most platforms have the C99 standard integer types. */
53
James Zernc87f32c2014-09-30 16:06:23 -070054#if defined(__cplusplus)
55# if !defined(__STDC_FORMAT_MACROS)
56# define __STDC_FORMAT_MACROS
57# endif
58# if !defined(__STDC_LIMIT_MACROS)
59# define __STDC_LIMIT_MACROS
60# endif
61#endif // __cplusplus
62
John Koleszar1df03142010-05-20 14:44:18 -040063#include <stdint.h>
John Koleszar1df03142010-05-20 14:44:18 -040064
John Koleszar0ea50ce2010-05-18 11:58:33 -040065#endif
66
John Koleszar4ead98f2011-05-05 10:53:24 -040067/* VS2010 defines stdint.h, but not inttypes.h */
Tom Finegan7320fdd2014-02-10 15:30:43 -080068#if defined(_MSC_VER) && _MSC_VER < 1800
John Koleszar4ead98f2011-05-05 10:53:24 -040069#define PRId64 "I64d"
70#else
71#include <inttypes.h>
72#endif
73
James Zern7386bde2013-12-15 18:26:15 -080074#endif // VPX_VPX_INTEGER_H_