| 1 | #ifndef FUNC_DEF_IN |
| 2 | #define FUNC_DEF_IN |
| 3 | |
| 4 | // F32 - function available on all 32 bit architectures |
| 5 | // F64 - function available on all 64 bit architectures |
| 6 | // F_X86_ANY - function available on i386 and x86_64 |
| 7 | // F_I386 - function available only on i386 |
| 8 | // F_X64 - function available only on x86_64 |
| 9 | // F_ARM32 - function available only on arm32 |
| 10 | // F_ARM64 - function available only on arm64 |
| 11 | // F_ARM_ANY - function available on 32 and 64 bit arm |
| 12 | // F_NON_I386 - function available on everything but i386 |
| 13 | // F_NON_X64 - function available on everything but x86_64 |
| 14 | // F_NON_ARM64 - function available on everything but arm64 |
| 15 | #if defined(__x86_64__) |
| 16 | #define F64(x) x |
| 17 | #define F_X64(x) x |
| 18 | #define F_X86_ANY(x) x |
| 19 | #define F_X86_NATIVE(x) x |
| 20 | #define F_NON_I386(x) x |
| 21 | #define F_NON_ARM64(x) x |
| 22 | #if defined(__arm64ec__) |
| 23 | #define F_ARM_ANY(x) x |
| 24 | #undef F_X86_NATIVE |
| 25 | #endif |
| 26 | #elif defined(__i386__) |
| 27 | #define F32(x) x |
| 28 | #define F_I386(x) x |
| 29 | #define F_X86_ANY(x) x |
| 30 | #define F_X86_NATIVE(x) x |
| 31 | #define F_NON_X64(x) x |
| 32 | #define F_NON_ARM64(x) x |
| 33 | #elif defined(__arm__) |
| 34 | #define F32(x) x |
| 35 | #define F_ARM32(x) x |
| 36 | #define F_ARM_NATIVE(x) x |
| 37 | #define F_NON_I386(x) x |
| 38 | #define F_NON_X64(x) x |
| 39 | #define F_NON_ARM64(x) x |
| 40 | #elif defined(__aarch64__) |
| 41 | #define F64(x) x |
| 42 | #define F_ARM64(x) x |
| 43 | #define F_ARM_NATIVE(x) x |
| 44 | #define F_NON_I386(x) x |
| 45 | #define F_NON_X64(x) x |
| 46 | #else |
| 47 | #error Unrecognized architecture |
| 48 | #endif |
| 49 | |
| 50 | #ifndef F32 |
| 51 | #define F32(x) |
| 52 | #endif |
| 53 | #ifndef F64 |
| 54 | #define F64(x) |
| 55 | #endif |
| 56 | #ifndef F_X86_ANY |
| 57 | #define F_X86_ANY(x) |
| 58 | #endif |
| 59 | #ifndef F_X86_NATIVE(x) |
| 60 | #define F_X86_NATIVE(x) |
| 61 | #endif |
| 62 | #ifndef F_I386 |
| 63 | #define F_I386(x) |
| 64 | #endif |
| 65 | #ifndef F_X64 |
| 66 | #define F_X64(x) |
| 67 | #endif |
| 68 | #ifndef F_ARM_NATIVE |
| 69 | #define F_ARM_NATIVE(x) |
| 70 | #endif |
| 71 | #ifndef F_ARM_ANY |
| 72 | #define F_ARM_ANY(x) F_ARM_NATIVE(x) |
| 73 | #endif |
| 74 | #ifndef F_ARM32 |
| 75 | #define F_ARM32(x) |
| 76 | #endif |
| 77 | #ifndef F_ARM64 |
| 78 | #define F_ARM64(x) |
| 79 | #endif |
| 80 | #ifndef F_NON_I386 |
| 81 | #define F_NON_I386(x) |
| 82 | #endif |
| 83 | #ifndef F_NON_X64 |
| 84 | #define F_NON_X64(x) |
| 85 | #endif |
| 86 | #ifndef F_NON_ARM64 |
| 87 | #define F_NON_ARM64(x) |
| 88 | #endif |
| 89 | |
| 90 | #if defined(__i386__) |
| 91 | #define STDCALL_DECORATED_EXPORT(symbol) symbol == _ ## symbol |
| 92 | #define FASTCALL_DECORATED_EXPORT(symbol) symbol == symbol |
| 93 | #endif |
| 94 | |
| 95 | #if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__ |
| 96 | #define F_LD64(x) x |
| 97 | #define F_LD80(x) |
| 98 | #else |
| 99 | #define F_LD64(x) |
| 100 | #define F_LD80(x) x |
| 101 | #endif |
| 102 | |
| 103 | #endif // FUNC_DEF_IN |