2 Purpose: Check denorm double value.
5 Originator: From the original ffitest.c */
14 unsigned char c
[sizeof (double)];
19 static double dblit(double d
)
27 ffi_type
*args
[MAX_ARGS
];
28 void *values
[MAX_ARGS
];
33 args
[0] = &ffi_type_double
;
36 /* Initialize the cif */
37 CHECK(ffi_prep_cif(&cif
, FFI_DEFAULT_ABI
, 1,
38 &ffi_type_double
, args
) == FFI_OK
);
42 /* Put a canary in the return array. This is a regression test for
44 memset(result
[1].c
, CANARY
, sizeof (double));
46 ffi_call(&cif
, FFI_FN(dblit
), &result
[0].d
, values
);
48 /* The standard delta check doesn't work for denorms. Since we didn't do
49 any arithmetic, we should get the original result back, and hence an
50 exact check should be OK here. */
52 CHECK(result
[0].d
== dblit(d
));
54 /* Check the canary. */
55 for (i
= 0; i
< sizeof (double); ++i
)
56 CHECK(result
[1].c
[i
] == CANARY
);