| Submitter | Richard Henderson |
|---|---|
| Date | Sept. 28, 2012, 1:13 a.m. |
| Message ID | <1348794785-28576-1-git-send-email-rth@twiddle.net> |
| Download | mbox | patch |
| Permalink | /patch/187676/ |
| State | New |
| Headers | show |
Comments
On 28 September 2012 02:13, Richard Henderson <rth@twiddle.net> wrote: > Signed-off-by: Richard Henderson <rth@twiddle.net> > --- > fpu/softfloat.c | 6 ++++++ > fpu/softfloat.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/fpu/softfloat.c b/fpu/softfloat.c > index 45f105a..8df3a32 100644 > --- a/fpu/softfloat.c > +++ b/fpu/softfloat.c > @@ -1337,6 +1337,12 @@ float128 int64_to_float128( int64 a STATUS_PARAM ) > > } > > +float128 uint64_to_float128( uint64 a STATUS_PARAM ) > +{ > + if ( a == 0 ) return packFloat128( 0, 0, 0, 0 ); It would be more in line with the other float sizes to have #define float128_zero make_float128(0, 0) and then return float128_zero here. > + return normalizeRoundAndPackFloat128( 0, 0x406E, a, 0 STATUS_VAR ); (I assume you've tested at least enough to confirm that 0x406E is the right number and not off by one one way or the other :-)) Incidentally personally I prefer to follow QEMU's spacing/bracing style rather than the insane original-softfloat one, when making changes. But the file is enough of a mess that I don't care much one way or another, if you prefer to follow local style. -- PMM
Patch
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 45f105a..8df3a32 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1337,6 +1337,12 @@ float128 int64_to_float128( int64 a STATUS_PARAM ) } +float128 uint64_to_float128( uint64 a STATUS_PARAM ) +{ + if ( a == 0 ) return packFloat128( 0, 0, 0, 0 ); + return normalizeRoundAndPackFloat128( 0, 0x406E, a, 0 STATUS_VAR ); +} + /*---------------------------------------------------------------------------- | Returns the result of converting the single-precision floating-point value | `a' to the 32-bit two's complement integer format. The conversion is diff --git a/fpu/softfloat.h b/fpu/softfloat.h index d8999b3..ee925ad 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -237,6 +237,7 @@ float64 int64_to_float64( int64 STATUS_PARAM ); float64 uint64_to_float64( uint64 STATUS_PARAM ); floatx80 int64_to_floatx80( int64 STATUS_PARAM ); float128 int64_to_float128( int64 STATUS_PARAM ); +float128 uint64_to_float128( uint64 STATUS_PARAM ); /*---------------------------------------------------------------------------- | Software half-precision conversion routines.
Signed-off-by: Richard Henderson <rth@twiddle.net> --- fpu/softfloat.c | 6 ++++++ fpu/softfloat.h | 1 + 2 files changed, 7 insertions(+)