arch.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
  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. // This file contains platform-specific typedefs and defines.
  11. // Much of it is derived from Chromium's build/build_config.h.
  12. #ifndef RTC_BASE_SYSTEM_ARCH_H_
  13. #define RTC_BASE_SYSTEM_ARCH_H_
  14. // Processor architecture detection. For more info on what's defined, see:
  15. // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
  16. // http://www.agner.org/optimize/calling_conventions.pdf
  17. // or with gcc, run: "echo | gcc -E -dM -"
  18. #if defined(_M_X64) || defined(__x86_64__)
  19. #define WEBRTC_ARCH_X86_FAMILY
  20. #define WEBRTC_ARCH_X86_64
  21. #define WEBRTC_ARCH_64_BITS
  22. #define WEBRTC_ARCH_LITTLE_ENDIAN
  23. #elif defined(_M_ARM64) || defined(__aarch64__)
  24. #define WEBRTC_ARCH_ARM_FAMILY
  25. #define WEBRTC_ARCH_64_BITS
  26. #define WEBRTC_ARCH_LITTLE_ENDIAN
  27. #elif defined(_M_IX86) || defined(__i386__)
  28. #define WEBRTC_ARCH_X86_FAMILY
  29. #define WEBRTC_ARCH_X86
  30. #define WEBRTC_ARCH_32_BITS
  31. #define WEBRTC_ARCH_LITTLE_ENDIAN
  32. #elif defined(__ARMEL__)
  33. #define WEBRTC_ARCH_ARM_FAMILY
  34. #define WEBRTC_ARCH_32_BITS
  35. #define WEBRTC_ARCH_LITTLE_ENDIAN
  36. #elif defined(__MIPSEL__)
  37. #define WEBRTC_ARCH_MIPS_FAMILY
  38. #if defined(__LP64__)
  39. #define WEBRTC_ARCH_64_BITS
  40. #else
  41. #define WEBRTC_ARCH_32_BITS
  42. #endif
  43. #define WEBRTC_ARCH_LITTLE_ENDIAN
  44. #elif defined(__pnacl__)
  45. #define WEBRTC_ARCH_32_BITS
  46. #define WEBRTC_ARCH_LITTLE_ENDIAN
  47. #elif defined(__EMSCRIPTEN__)
  48. #define WEBRTC_ARCH_32_BITS
  49. #define WEBRTC_ARCH_LITTLE_ENDIAN
  50. #else
  51. #error Please add support for your architecture in rtc_base/system/arch.h
  52. #endif
  53. #if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN))
  54. #error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN
  55. #endif
  56. #endif // RTC_BASE_SYSTEM_ARCH_H_