2
Purpose: Check return value float.
5
Originator: From the original ffitest.c */
11
static int floating(int a, float b, double c, long double d, int e)
15
i = (int) ((float)a/b + ((float)c/(float)d));
23
ffi_type *args[MAX_ARGS];
24
void *values[MAX_ARGS];
33
args[0] = &ffi_type_sint;
35
args[1] = &ffi_type_float;
37
args[2] = &ffi_type_double;
39
args[3] = &ffi_type_longdouble;
41
args[4] = &ffi_type_sint;
44
/* Initialize the cif */
45
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 5,
46
&ffi_type_sint, args) == FFI_OK);
50
d = (double)1.0/(double)3.0;
54
floating (si1, f, d, ld, si2);
56
ffi_call(&cif, FFI_FN(floating), &rint, values);
58
printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld, si2));
60
CHECK(rint == floating(si1, f, d, ld, si2));