2 Purpose: Check return value double.
5 Originator: From the original ffitest.c */
16 unsigned char c
[sizeof (double)];
21 static double dblit(float f
)
29 ffi_type
*args
[MAX_ARGS
];
30 void *values
[MAX_ARGS
];
35 args
[0] = &ffi_type_float
;
38 /* Initialize the cif */
39 CHECK(ffi_prep_cif(&cif
, FFI_DEFAULT_ABI
, 1,
40 &ffi_type_double
, args
) == FFI_OK
);
44 /* Put a canary in the return array. This is a regression test for
46 memset(result
[1].c
, CANARY
, sizeof (double));
48 ffi_call(&cif
, FFI_FN(dblit
), &result
[0].d
, values
);
50 /* These are not always the same!! Check for a reasonable delta */
52 CHECK(fabs(result
[0].d
- dblit(f
)) < DBL_EPSILON
);
54 /* Check the canary. */
55 for (i
= 0; i
< sizeof (double); ++i
)
56 CHECK(result
[1].c
[i
] == CANARY
);