2 Purpose: Check float arguments with different orders.
5 Originator: From the original ffitest.c */
12 static double floating_1(float a, double b, long double c)
14 return (double) a + b + (double) c;
17 static double floating_2(long double a, double b, float c)
19 return (double) a + b + (double) c;
25 ffi_type *args[MAX_ARGS];
26 void *values[MAX_ARGS];
33 args[0] = &ffi_type_float;
35 args[1] = &ffi_type_double;
37 args[2] = &ffi_type_longdouble;
40 /* Initialize the cif */
41 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
42 &ffi_type_double, args) == FFI_OK);
45 d = (double)1.0/(double)3.0;
48 floating_1 (f, d, ld);
50 ffi_call(&cif, FFI_FN(floating_1), &rd, values);
52 CHECK(rd - floating_1(f, d, ld) < DBL_EPSILON);
54 args[0] = &ffi_type_longdouble;
56 args[1] = &ffi_type_double;
58 args[2] = &ffi_type_float;
61 /* Initialize the cif */
62 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
63 &ffi_type_double, args) == FFI_OK);
65 floating_2 (ld, d, f);
67 ffi_call(&cif, FFI_FN(floating_2), &rd, values);
69 CHECK(rd - floating_2(ld, d, f) < DBL_EPSILON);