blob: f9055d9d134cbd1fb7bfb292b72c4bf912ee37f7 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * 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
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
ajm@google.comce7c2a22011-08-04 01:50:00 +000011// This file contains platform-specific typedefs and defines.
niklase@google.com470e71d2011-07-07 08:21:25 +000012
ajm@google.comce7c2a22011-08-04 01:50:00 +000013#ifndef WEBRTC_TYPEDEFS_H_
14#define WEBRTC_TYPEDEFS_H_
15
16// Reserved words definitions
andrew@webrtc.orgb8015712011-09-08 18:37:59 +000017// TODO(andrew): Look at removing these.
niklase@google.com470e71d2011-07-07 08:21:25 +000018#define WEBRTC_EXTERN extern
19#define G_CONST const
20#define WEBRTC_INLINE extern __inline
21
ajm@google.comce7c2a22011-08-04 01:50:00 +000022// Derived from Chromium's build/build_config.h
23// Processor architecture detection. For more info on what's defined, see:
24// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
25// http://www.agner.org/optimize/calling_conventions.pdf
26// or with gcc, run: "echo | gcc -E -dM -"
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000027// TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN.
ajm@google.comce7c2a22011-08-04 01:50:00 +000028#if defined(_M_X64) || defined(__x86_64__)
29#define WEBRTC_ARCH_X86_FAMILY
30#define WEBRTC_ARCH_X86_64
31#define WEBRTC_ARCH_64_BITS
32#define WEBRTC_ARCH_LITTLE_ENDIAN
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000033#define WEBRTC_LITTLE_ENDIAN
ajm@google.comce7c2a22011-08-04 01:50:00 +000034#elif defined(_M_IX86) || defined(__i386__)
35#define WEBRTC_ARCH_X86_FAMILY
36#define WEBRTC_ARCH_X86
37#define WEBRTC_ARCH_32_BITS
38#define WEBRTC_ARCH_LITTLE_ENDIAN
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000039#define WEBRTC_LITTLE_ENDIAN
ajm@google.comce7c2a22011-08-04 01:50:00 +000040#elif defined(__ARMEL__)
andrew@webrtc.orgb8015712011-09-08 18:37:59 +000041// TODO(andrew): We'd prefer to control platform defines here, but this is
42// currently provided by the Android makefiles. Commented to avoid duplicate
43// definition warnings.
44//#define WEBRTC_ARCH_ARM
45// TODO(andrew): Chromium uses the following two defines. Should we switch?
ajm@google.comce7c2a22011-08-04 01:50:00 +000046//#define WEBRTC_ARCH_ARM_FAMILY
47//#define WEBRTC_ARCH_ARMEL
48#define WEBRTC_ARCH_32_BITS
49#define WEBRTC_ARCH_LITTLE_ENDIAN
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000050#define WEBRTC_LITTLE_ENDIAN
ajm@google.comce7c2a22011-08-04 01:50:00 +000051#else
52#error Please add support for your architecture in typedefs.h
53#endif
54
andrew@webrtc.org86b85db2011-09-19 18:48:25 +000055#if defined(__SSE2__) || defined(_MSC_VER)
ajm@google.comce7c2a22011-08-04 01:50:00 +000056#define WEBRTC_USE_SSE2
57#endif
58
niklase@google.com470e71d2011-07-07 08:21:25 +000059#if !defined(_MSC_VER)
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000060#include <stdint.h>
niklase@google.com470e71d2011-07-07 08:21:25 +000061#else
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000062// Define C99 equivalent types, since MSVC doesn't provide stdint.h.
63typedef signed char int8_t;
64typedef signed short int16_t;
65typedef signed int int32_t;
66typedef __int64 int64_t;
67typedef unsigned char uint8_t;
68typedef unsigned short uint16_t;
69typedef unsigned int uint32_t;
70typedef unsigned __int64 uint64_t;
niklase@google.com470e71d2011-07-07 08:21:25 +000071#endif
72
andrew@webrtc.orgd62d7302012-03-01 21:39:57 +000073// TODO(andrew): remove WebRtc_ types:
74// http://code.google.com/p/webrtc/issues/detail?id=314
75// TODO(leozwang): change to WebRtc_Word8 to use int8_t:
76// http://code.google.com/p/webrtc/issues/detail?id=311
77typedef char WebRtc_Word8;
78typedef int16_t WebRtc_Word16;
79typedef int32_t WebRtc_Word32;
80typedef int64_t WebRtc_Word64;
81typedef uint8_t WebRtc_UWord8;
82typedef uint16_t WebRtc_UWord16;
83typedef uint32_t WebRtc_UWord32;
84typedef uint64_t WebRtc_UWord64;
niklase@google.com470e71d2011-07-07 08:21:25 +000085
ajm@google.comce7c2a22011-08-04 01:50:00 +000086#endif // WEBRTC_TYPEDEFS_H_