mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00

In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC from src/webrtc to src/ (in order to preserve an healthy git history). This CL takes care of fixing header guards, #include paths, etc... NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true TBR=tommi@webrtc.org Bug: chromium:611808 Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578 Reviewed-on: https://webrtc-review.googlesource.com/1561 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19846}
70 lines
2.2 KiB
C
70 lines
2.2 KiB
C
/*
|
|
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef RTC_BASE_BASICTYPES_H_
|
|
#define RTC_BASE_BASICTYPES_H_
|
|
|
|
#include <stddef.h> // for NULL, size_t
|
|
#include <stdint.h> // for uintptr_t and (u)int_t types.
|
|
|
|
// Detect compiler is for x86 or x64.
|
|
#if defined(__x86_64__) || defined(_M_X64) || \
|
|
defined(__i386__) || defined(_M_IX86)
|
|
#define CPU_X86 1
|
|
#endif
|
|
|
|
// Detect compiler is for arm.
|
|
#if defined(__arm__) || defined(_M_ARM)
|
|
#define CPU_ARM 1
|
|
#endif
|
|
|
|
#if defined(CPU_X86) && defined(CPU_ARM)
|
|
#error CPU_X86 and CPU_ARM both defined.
|
|
#endif
|
|
|
|
#if !defined(RTC_ARCH_CPU_BIG_ENDIAN) && !defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
|
|
// x86, arm or GCC provided __BYTE_ORDER__ macros
|
|
#if defined(CPU_X86) || defined(CPU_ARM) || \
|
|
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
#define RTC_ARCH_CPU_LITTLE_ENDIAN
|
|
#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
#define RTC_ARCH_CPU_BIG_ENDIAN
|
|
#else
|
|
#error RTC_ARCH_CPU_BIG_ENDIAN or RTC_ARCH_CPU_LITTLE_ENDIAN should be defined.
|
|
#endif
|
|
#endif
|
|
|
|
#if defined(RTC_ARCH_CPU_BIG_ENDIAN) && defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
|
|
#error RTC_ARCH_CPU_BIG_ENDIAN and RTC_ARCH_CPU_LITTLE_ENDIAN both defined.
|
|
#endif
|
|
|
|
#if defined(WEBRTC_WIN)
|
|
typedef int socklen_t;
|
|
#endif
|
|
|
|
// The following only works for C++
|
|
#ifdef __cplusplus
|
|
|
|
#ifndef ALIGNP
|
|
#define ALIGNP(p, t) \
|
|
(reinterpret_cast<uint8_t*>(((reinterpret_cast<uintptr_t>(p) + \
|
|
((t) - 1)) & ~((t) - 1))))
|
|
#endif
|
|
|
|
#define RTC_IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
|
|
|
|
// Use these to declare and define a static local variable that gets leaked so
|
|
// that its destructors are not called at exit.
|
|
#define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \
|
|
static type& name = *new type arguments
|
|
|
|
#endif // __cplusplus
|
|
|
|
#endif // RTC_BASE_BASICTYPES_H_
|