softfloat missing functions]
PATCH 1/1 softfloat missing functions]
Repost: looks like this message never reached the list....
-------- Forwarded Message --------
Quoted 58 lines
From: J. Mayer <[email protected]>
To: Julian Seward <[email protected]>
Cc: [email protected]
Subject: Re: [Qemu-devel] [PATCH] softfloat missing functions
Date: Mon, 19 Mar 2007 22:10:14 +0100Quoted 5 lines · Julian Seward
Quoted 3 lines
Note that
float64_to_uint64functions are not correct, as they won't return results betweenINT64_MAXandUINT64_MAX. Hope someone may know the proper solution for this.How about this?
Yes, it seems to be the correct way, but thinking more about the problem, it appeared to me that the implementation could be even easier than yours. It seems to me that this may be sufficient:
uint64_tfloat64_to_uint64(float64 aSTATUS_PARAM){ int64_t v; v = llrint(a + (float64)INT64_MIN); return v - INT64_MIN; } uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM) { int64_t v; v = (int64_t)(a + (float64)INT64_MIN); return v - INT64_MIN; }For "not-native" softfloat, this gives:
uint64_tfloat64_to_uint64(float64 aSTATUS_PARAM){ int64_t v; v = int64_to_float64(INT64_MIN STATUS_VAR); v = float64_to_int64((a + v) STATUS_VAR); return v - INT64_MIN; }
uint64_tfloat64_to_uint64_round_to_zero(float64 aSTATUS_PARAM){ int64_t v; v = int64_to_float64(INT64_MIN STATUS_VAR); v = float64_to_int64_round_to_zero((a + v) STATUS_VAR); return v - INT64_MIN; }This should also give the correct result for NaN and overflows, if we rely to the fact
float64_to_int64is correct. Please tell me if I'm wrong !
Signature · 2 lines
J. Mayer <[email protected]> Never organized