2 Purpose: Check float arguments with different orders.
5 Originator: From the original ffitest.c */
14 static double floating_1(float a
, double b
, long double c
)
16 return (double) a
+ b
+ (double) c
;
19 static double floating_2(long double a
, double b
, float c
)
21 return (double) a
+ b
+ (double) c
;
27 ffi_type
*args
[MAX_ARGS
];
28 void *values
[MAX_ARGS
];
35 args
[0] = &ffi_type_float
;
37 args
[1] = &ffi_type_double
;
39 args
[2] = &ffi_type_longdouble
;
42 /* Initialize the cif */
43 CHECK(ffi_prep_cif(&cif
, FFI_DEFAULT_ABI
, 3,
44 &ffi_type_double
, args
) == FFI_OK
);
47 d
= (double)1.0/(double)3.0;
50 floating_1 (f
, d
, ld
);
52 ffi_call(&cif
, FFI_FN(floating_1
), &rd
, values
);
54 CHECK(fabs(rd
- floating_1(f
, d
, ld
)) < DBL_EPSILON
);
56 args
[0] = &ffi_type_longdouble
;
58 args
[1] = &ffi_type_double
;
60 args
[2] = &ffi_type_float
;
63 /* Initialize the cif */
64 CHECK(ffi_prep_cif(&cif
, FFI_DEFAULT_ABI
, 3,
65 &ffi_type_double
, args
) == FFI_OK
);
67 floating_2 (ld
, d
, f
);
69 ffi_call(&cif
, FFI_FN(floating_2
), &rd
, values
);
71 CHECK(fabs(rd
- floating_2(ld
, d
, f
)) < DBL_EPSILON
);