ed25519-donna-portable-identify.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* os */
  2. #if defined(_WIN32) || defined(_WIN64) || defined(__TOS_WIN__) || defined(__WINDOWS__)
  3. #define OS_WINDOWS
  4. #elif defined(sun) || defined(__sun) || defined(__SVR4) || defined(__svr4__)
  5. #define OS_SOLARIS
  6. #else
  7. #include <sys/param.h> /* need this to define BSD */
  8. #define OS_NIX
  9. #if defined(__linux__)
  10. #define OS_LINUX
  11. #elif defined(BSD)
  12. #define OS_BSD
  13. #if defined(MACOS_X) || (defined(__APPLE__) & defined(__MACH__))
  14. #define OS_OSX
  15. #elif defined(macintosh) || defined(Macintosh)
  16. #define OS_MAC
  17. #elif defined(__OpenBSD__)
  18. #define OS_OPENBSD
  19. #endif
  20. #endif
  21. #endif
  22. /* compiler */
  23. #if defined(_MSC_VER)
  24. #define COMPILER_MSVC
  25. #endif
  26. #if defined(__ICC)
  27. #define COMPILER_INTEL
  28. #endif
  29. #if defined(__GNUC__)
  30. #if (__GNUC__ >= 3)
  31. #define COMPILER_GCC ((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + (__GNUC_PATCHLEVEL__))
  32. #else
  33. #define COMPILER_GCC ((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) )
  34. #endif
  35. #endif
  36. #if defined(__PATHCC__)
  37. #define COMPILER_PATHCC
  38. #endif
  39. #if defined(__clang__)
  40. #define COMPILER_CLANG ((__clang_major__ * 10000) + (__clang_minor__ * 100) + (__clang_patchlevel__))
  41. #endif
  42. /* cpu */
  43. #if defined(__amd64__) || defined(__amd64) || defined(__x86_64__ ) || defined(_M_X64)
  44. #define CPU_X86_64
  45. #elif defined(__i586__) || defined(__i686__) || (defined(_M_IX86) && (_M_IX86 >= 500))
  46. #define CPU_X86 500
  47. #elif defined(__i486__) || (defined(_M_IX86) && (_M_IX86 >= 400))
  48. #define CPU_X86 400
  49. #elif defined(__i386__) || (defined(_M_IX86) && (_M_IX86 >= 300)) || defined(__X86__) || defined(_X86_) || defined(__I86__)
  50. #define CPU_X86 300
  51. #elif defined(__ia64__) || defined(_IA64) || defined(__IA64__) || defined(_M_IA64) || defined(__ia64)
  52. #define CPU_IA64
  53. #endif
  54. #if defined(__sparc__) || defined(__sparc) || defined(__sparcv9)
  55. #define CPU_SPARC
  56. #if defined(__sparcv9)
  57. #define CPU_SPARC64
  58. #endif
  59. #endif
  60. #if defined(powerpc) || defined(__PPC__) || defined(__ppc__) || defined(_ARCH_PPC) || defined(__powerpc__) || defined(__powerpc) || defined(POWERPC) || defined(_M_PPC)
  61. #define CPU_PPC
  62. #if defined(_ARCH_PWR7)
  63. #define CPU_POWER7
  64. #elif defined(__64BIT__)
  65. #define CPU_PPC64
  66. #else
  67. #define CPU_PPC32
  68. #endif
  69. #endif
  70. #if defined(__hppa__) || defined(__hppa)
  71. #define CPU_HPPA
  72. #endif
  73. #if defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
  74. #define CPU_ALPHA
  75. #endif
  76. #if defined(__aarch64__)
  77. #define CPU_AARCH64
  78. #endif
  79. /* 64 bit cpu */
  80. #if defined(CPU_X86_64) || defined(CPU_IA64) || defined(CPU_SPARC64) || defined(CPU_AARCH64) || defined(__64BIT__) || defined(__LP64__) || defined(_LP64) || (defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64))
  81. #define CPU_64BITS
  82. #endif
  83. #if defined(COMPILER_MSVC)
  84. typedef signed char int8_t;
  85. typedef unsigned char uint8_t;
  86. typedef signed short int16_t;
  87. typedef unsigned short uint16_t;
  88. typedef signed int int32_t;
  89. typedef unsigned int uint32_t;
  90. typedef signed __int64 int64_t;
  91. typedef unsigned __int64 uint64_t;
  92. #else
  93. #include <stdint.h>
  94. #endif