niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [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 +0000 | [diff] [blame] | 11 | // This file contains platform-specific typedefs and defines. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 13 | #ifndef WEBRTC_TYPEDEFS_H_ |
| 14 | #define WEBRTC_TYPEDEFS_H_ |
| 15 | |
| 16 | // Reserved words definitions |
andrew@webrtc.org | b801571 | 2011-09-08 18:37:59 +0000 | [diff] [blame] | 17 | // TODO(andrew): Look at removing these. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 18 | #define WEBRTC_EXTERN extern |
| 19 | #define G_CONST const |
| 20 | #define WEBRTC_INLINE extern __inline |
| 21 | |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 22 | // 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.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 27 | // TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN. |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 28 | #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.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 33 | #define WEBRTC_LITTLE_ENDIAN |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 34 | #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.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 39 | #define WEBRTC_LITTLE_ENDIAN |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 40 | #elif defined(__ARMEL__) |
andrew@webrtc.org | b801571 | 2011-09-08 18:37:59 +0000 | [diff] [blame] | 41 | // 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.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 46 | //#define WEBRTC_ARCH_ARM_FAMILY |
| 47 | //#define WEBRTC_ARCH_ARMEL |
| 48 | #define WEBRTC_ARCH_32_BITS |
| 49 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 50 | #define WEBRTC_LITTLE_ENDIAN |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 51 | #else |
| 52 | #error Please add support for your architecture in typedefs.h |
| 53 | #endif |
| 54 | |
andrew@webrtc.org | 86b85db | 2011-09-19 18:48:25 +0000 | [diff] [blame] | 55 | #if defined(__SSE2__) || defined(_MSC_VER) |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 56 | #define WEBRTC_USE_SSE2 |
| 57 | #endif |
| 58 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | #if !defined(_MSC_VER) |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 60 | #include <stdint.h> |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 61 | #else |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 62 | // Define C99 equivalent types, since MSVC doesn't provide stdint.h. |
| 63 | typedef signed char int8_t; |
| 64 | typedef signed short int16_t; |
| 65 | typedef signed int int32_t; |
| 66 | typedef __int64 int64_t; |
| 67 | typedef unsigned char uint8_t; |
| 68 | typedef unsigned short uint16_t; |
| 69 | typedef unsigned int uint32_t; |
| 70 | typedef unsigned __int64 uint64_t; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | #endif |
| 72 | |
andrew@webrtc.org | d62d730 | 2012-03-01 21:39:57 +0000 | [diff] [blame^] | 73 | // 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 |
| 77 | typedef char WebRtc_Word8; |
| 78 | typedef int16_t WebRtc_Word16; |
| 79 | typedef int32_t WebRtc_Word32; |
| 80 | typedef int64_t WebRtc_Word64; |
| 81 | typedef uint8_t WebRtc_UWord8; |
| 82 | typedef uint16_t WebRtc_UWord16; |
| 83 | typedef uint32_t WebRtc_UWord32; |
| 84 | typedef uint64_t WebRtc_UWord64; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | |
ajm@google.com | ce7c2a2 | 2011-08-04 01:50:00 +0000 | [diff] [blame] | 86 | #endif // WEBRTC_TYPEDEFS_H_ |