common.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. // DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
  6. // since it slows down the build a lot.
  7. #include <cstdlib>
  8. #include <cstdio>
  9. #include <cstring>
  10. #include "common/assert.h"
  11. #include "common/logging/log.h"
  12. #include "common/common_types.h"
  13. #include "common/common_funcs.h"
  14. #include "common/common_paths.h"
  15. #include "common/platform.h"
  16. #ifdef _WIN32
  17. // Alignment
  18. #define MEMORY_ALIGNED16(x) __declspec(align(16)) x
  19. #define MEMORY_ALIGNED32(x) __declspec(align(32)) x
  20. #define MEMORY_ALIGNED64(x) __declspec(align(64)) x
  21. #define MEMORY_ALIGNED128(x) __declspec(align(128)) x
  22. #else
  23. // Windows compatibility
  24. #ifdef _LP64
  25. #define _M_X64 1
  26. #else
  27. #define _M_IX86 1
  28. #endif
  29. #define __forceinline inline __attribute__((always_inline))
  30. #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
  31. #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
  32. #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
  33. #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
  34. #endif
  35. #include "swap.h"