blob: d6d4015533a18642431b0934cb2245770df82f3b [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
andrew@webrtc.orgd62d7302012-03-01 21:39:572 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:253 *
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:0011// This file contains platform-specific typedefs and defines.
andrew@webrtc.orgd84d1112012-08-31 23:17:5312// Much of it is derived from Chromium's build/build_config.h.
niklase@google.com470e71d2011-07-07 08:21:2513
ajm@google.comce7c2a22011-08-04 01:50:0014#ifndef WEBRTC_TYPEDEFS_H_
15#define WEBRTC_TYPEDEFS_H_
16
17// Reserved words definitions
andrew@webrtc.orgd84d1112012-08-31 23:17:5318// TODO(andrew): Remove this.
niklase@google.com470e71d2011-07-07 08:21:2519#define G_CONST const
niklase@google.com470e71d2011-07-07 08:21:2520
andrew@webrtc.orgd84d1112012-08-31 23:17:5321// For access to standard POSIXish features, use WEBRTC_POSIX instead of a
22// more specific macro.
23#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) || \
24 defined(WEBRTC_ANDROID)
25#define WEBRTC_POSIX
26#endif
27
ajm@google.comce7c2a22011-08-04 01:50:0028// Processor architecture detection. For more info on what's defined, see:
29// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
30// http://www.agner.org/optimize/calling_conventions.pdf
31// or with gcc, run: "echo | gcc -E -dM -"
andrew@webrtc.orgd62d7302012-03-01 21:39:5732// TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN.
ajm@google.comce7c2a22011-08-04 01:50:0033#if defined(_M_X64) || defined(__x86_64__)
34#define WEBRTC_ARCH_X86_FAMILY
35#define WEBRTC_ARCH_X86_64
36#define WEBRTC_ARCH_64_BITS
37#define WEBRTC_ARCH_LITTLE_ENDIAN
andrew@webrtc.orgd62d7302012-03-01 21:39:5738#define WEBRTC_LITTLE_ENDIAN
ajm@google.comce7c2a22011-08-04 01:50:0039#elif defined(_M_IX86) || defined(__i386__)
40#define WEBRTC_ARCH_X86_FAMILY
41#define WEBRTC_ARCH_X86
42#define WEBRTC_ARCH_32_BITS
43#define WEBRTC_ARCH_LITTLE_ENDIAN
andrew@webrtc.orgd62d7302012-03-01 21:39:5744#define WEBRTC_LITTLE_ENDIAN
ajm@google.comce7c2a22011-08-04 01:50:0045#elif defined(__ARMEL__)
andrew@webrtc.orgb8015712011-09-08 18:37:5946// TODO(andrew): We'd prefer to control platform defines here, but this is
47// currently provided by the Android makefiles. Commented to avoid duplicate
48// definition warnings.
49//#define WEBRTC_ARCH_ARM
50// TODO(andrew): Chromium uses the following two defines. Should we switch?
ajm@google.comce7c2a22011-08-04 01:50:0051//#define WEBRTC_ARCH_ARM_FAMILY
52//#define WEBRTC_ARCH_ARMEL
53#define WEBRTC_ARCH_32_BITS
54#define WEBRTC_ARCH_LITTLE_ENDIAN
andrew@webrtc.orgd62d7302012-03-01 21:39:5755#define WEBRTC_LITTLE_ENDIAN
andrew@webrtc.orge22beab2012-06-27 22:24:4356#elif defined(__MIPSEL__)
57#define WEBRTC_ARCH_32_BITS
58#define WEBRTC_ARCH_LITTLE_ENDIAN
59#define WEBRTC_LITTLE_ENDIAN
ajm@google.comce7c2a22011-08-04 01:50:0060#else
61#error Please add support for your architecture in typedefs.h
62#endif
63
andrew@webrtc.org86b85db2011-09-19 18:48:2564#if defined(__SSE2__) || defined(_MSC_VER)
ajm@google.comce7c2a22011-08-04 01:50:0065#define WEBRTC_USE_SSE2
66#endif
67
niklase@google.com470e71d2011-07-07 08:21:2568#if !defined(_MSC_VER)
andrew@webrtc.orgd62d7302012-03-01 21:39:5769#include <stdint.h>
niklase@google.com470e71d2011-07-07 08:21:2570#else
andrew@webrtc.orgd62d7302012-03-01 21:39:5771// Define C99 equivalent types, since MSVC doesn't provide stdint.h.
72typedef signed char int8_t;
73typedef signed short int16_t;
74typedef signed int int32_t;
75typedef __int64 int64_t;
76typedef unsigned char uint8_t;
77typedef unsigned short uint16_t;
78typedef unsigned int uint32_t;
79typedef unsigned __int64 uint64_t;
niklase@google.com470e71d2011-07-07 08:21:2580#endif
81
andrew@webrtc.orgd62d7302012-03-01 21:39:5782// TODO(andrew): remove WebRtc_ types:
83// http://code.google.com/p/webrtc/issues/detail?id=314
leozwang@webrtc.orgc197b122012-03-12 16:52:2884typedef int8_t WebRtc_Word8;
andrew@webrtc.orgd62d7302012-03-01 21:39:5785typedef int16_t WebRtc_Word16;
86typedef int32_t WebRtc_Word32;
87typedef int64_t WebRtc_Word64;
88typedef uint8_t WebRtc_UWord8;
89typedef uint16_t WebRtc_UWord16;
90typedef uint32_t WebRtc_UWord32;
91typedef uint64_t WebRtc_UWord64;
niklase@google.com470e71d2011-07-07 08:21:2592
ajm@google.comce7c2a22011-08-04 01:50:0093#endif // WEBRTC_TYPEDEFS_H_