Dans float_of_bits, eviter de faire un load ou store flottant au cas ou le processeur serait en mode 'trapping' (PR#309)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3469 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
cb4fb47dde
commit
1d08b37615
|
@ -304,13 +304,13 @@ value gt_float(value f, value g) /* ML */
|
|||
|
||||
value float_of_bytes(value s) /* ML */
|
||||
{
|
||||
union { char bytes[8]; double d; } u;
|
||||
value d = copy_double(0.0);
|
||||
#ifdef ARCH_BIG_ENDIAN
|
||||
memcpy(u.bytes, String_val(s), 8);
|
||||
memcpy(String_val(d), String_val(s), 8);
|
||||
#else
|
||||
Reverse_64(u.bytes, String_val(s));
|
||||
Reverse_64(String_val(d), String_val(s));
|
||||
#endif
|
||||
return copy_double(u.d);
|
||||
return d;
|
||||
}
|
||||
|
||||
enum { FP_normal, FP_subnormal, FP_zero, FP_infinite, FP_nan };
|
||||
|
|
Loading…
Reference in New Issue