niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 1 | /* |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 3 | * |
| 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.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 11 | // This file contains platform-specific typedefs and defines. |
andrew@webrtc.org | d84d111 | 2012-08-31 23:17:53 | [diff] [blame] | 12 | // Much of it is derived from Chromium's build/build_config.h. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 13 | |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 14 | #ifndef WEBRTC_TYPEDEFS_H_ |
| 15 | #define WEBRTC_TYPEDEFS_H_ |
| 16 | |
| 17 | // Reserved words definitions |
andrew@webrtc.org | d84d111 | 2012-08-31 23:17:53 | [diff] [blame] | 18 | // TODO(andrew): Remove this. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 19 | #define G_CONST const |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 20 | |
andrew@webrtc.org | d84d111 | 2012-08-31 23:17:53 | [diff] [blame] | 21 | // 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.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 28 | // 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.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 32 | // TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN. |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 33 | #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.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 38 | #define WEBRTC_LITTLE_ENDIAN |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 39 | #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.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 44 | #define WEBRTC_LITTLE_ENDIAN |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 45 | #elif defined(__ARMEL__) |
andrew@webrtc.org | b801571 | 2011-09-08 18:37:59 | [diff] [blame] | 46 | // 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.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 51 | //#define WEBRTC_ARCH_ARM_FAMILY |
| 52 | //#define WEBRTC_ARCH_ARMEL |
| 53 | #define WEBRTC_ARCH_32_BITS |
| 54 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 55 | #define WEBRTC_LITTLE_ENDIAN |
andrew@webrtc.org | e22beab | 2012-06-27 22:24:43 | [diff] [blame] | 56 | #elif defined(__MIPSEL__) |
| 57 | #define WEBRTC_ARCH_32_BITS |
| 58 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
| 59 | #define WEBRTC_LITTLE_ENDIAN |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 60 | #else |
| 61 | #error Please add support for your architecture in typedefs.h |
| 62 | #endif |
| 63 | |
andrew@webrtc.org | 86b85db | 2011-09-19 18:48:25 | [diff] [blame] | 64 | #if defined(__SSE2__) || defined(_MSC_VER) |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 65 | #define WEBRTC_USE_SSE2 |
| 66 | #endif |
| 67 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 68 | #if !defined(_MSC_VER) |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 69 | #include <stdint.h> |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 70 | #else |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 71 | // Define C99 equivalent types, since MSVC doesn't provide stdint.h. |
| 72 | typedef signed char int8_t; |
| 73 | typedef signed short int16_t; |
| 74 | typedef signed int int32_t; |
| 75 | typedef __int64 int64_t; |
| 76 | typedef unsigned char uint8_t; |
| 77 | typedef unsigned short uint16_t; |
| 78 | typedef unsigned int uint32_t; |
| 79 | typedef unsigned __int64 uint64_t; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 80 | #endif |
| 81 | |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 82 | // TODO(andrew): remove WebRtc_ types: |
| 83 | // http://code.google.com/p/webrtc/issues/detail?id=314 |
leozwang@webrtc.org | c197b12 | 2012-03-12 16:52:28 | [diff] [blame] | 84 | typedef int8_t WebRtc_Word8; |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 | [diff] [blame] | 85 | typedef int16_t WebRtc_Word16; |
| 86 | typedef int32_t WebRtc_Word32; |
| 87 | typedef int64_t WebRtc_Word64; |
| 88 | typedef uint8_t WebRtc_UWord8; |
| 89 | typedef uint16_t WebRtc_UWord16; |
| 90 | typedef uint32_t WebRtc_UWord32; |
| 91 | typedef uint64_t WebRtc_UWord64; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 92 | |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 | [diff] [blame] | 93 | #endif // WEBRTC_TYPEDEFS_H_ |