|
infix
A JIT-Powered FFI Library for C
|
Unit test for FFI calls with special, non-standard, or platform-dependent primitive types. More...
Macros | |
| #define | DBLTAP_IMPLEMENTATION |
| #define | HAS_DISTINCT_LONG_DOUBLE 1 |
Functions | |
| long double | passthrough_long_double (long double v) |
| bool | check_s128 (__int128_t val) |
| bool | check_u128 (__uint128_t val) |
| __int128_t | return_s128 (void) |
| bool | s128_callback_handler (__int128_t val) |
| subtest ("Special type: long double") | |
| subtest ("Special type: __int128_t") | |
| subtest ("Special type: __uint128_t") | |
Variables | |
| const __int128_t | S128_CONSTANT = (((__int128_t)0x12345678ABCDDCBA) << 64) | 0x1122334455667788 |
| const __uint128_t | U128_CONSTANT = (((__uint128_t)0xFFFFFFFFFFFFFFFF) << 64) | 0xAABBCCDDEEFF0011 |
| TEST | |
Unit test for FFI calls with special, non-standard, or platform-dependent primitive types.
This test file validates the ABI implementation for primitive types that have unique or complex calling convention rules.
The test covers:
long double**: This type's size and representation vary by platform. On System V x64, it's an 80-bit extended-precision float passed on the x87 FPU stack, while on Windows and AArch64, it's often an alias for double. This test verifies the correct handling for platforms where it is a distinct type.__int128_t / __uint128_t**: These are 128-bit integer types provided as a compiler extension by GCC and Clang (but not MSVC). They are typically passed in a pair of general-purpose registers (e.g., RDI/RSI on SysV x64). This test verifies their handling in both forward and reverse calls.Each test is conditionally compiled to run only on architectures and compilers that support the specific type, ensuring the test suite remains portable.
| #define DBLTAP_IMPLEMENTATION |
| #define HAS_DISTINCT_LONG_DOUBLE 1 |
| bool check_s128 | ( | __int128_t | val | ) |
| bool check_u128 | ( | __uint128_t | val | ) |
| long double passthrough_long_double | ( | long double | v | ) |
| __int128_t return_s128 | ( | void | ) |
| bool s128_callback_handler | ( | __int128_t | val | ) |
| subtest | ( | "Special type: __int128_t" | ) |
| subtest | ( | "Special type: __uint128_t" | ) |
| subtest | ( | "Special type: long double" | ) |
| const __int128_t S128_CONSTANT = (((__int128_t)0x12345678ABCDDCBA) << 64) | 0x1122334455667788 |
| const __uint128_t U128_CONSTANT = (((__uint128_t)0xFFFFFFFFFFFFFFFF) << 64) | 0xAABBCCDDEEFF0011 |