Message ID | 20180109122252.17670-6-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | re-factor softfloat and add fp16 functions | expand |
On 9 January 2018 at 12:22, Alex Bennée <alex.bennee@linaro.org> wrote: > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > include/fpu/softfloat.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h > index dc71b01dba..8ab5d0df47 100644 > --- a/include/fpu/softfloat.h > +++ b/include/fpu/softfloat.h > @@ -363,6 +363,11 @@ static inline float16 float16_chs(float16 a) > return make_float16(float16_val(a) ^ 0x8000); > } > > +static inline float16 float16_set_sign(float16 a, int sign) > +{ > + return make_float16((float16_val(a) & 0x7fff) | (sign << 15)); > +} > + > /*---------------------------------------------------------------------------- > | The pattern for a default generated half-precision NaN. > *----------------------------------------------------------------------------*/ > -- Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index dc71b01dba..8ab5d0df47 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -363,6 +363,11 @@ static inline float16 float16_chs(float16 a) return make_float16(float16_val(a) ^ 0x8000); } +static inline float16 float16_set_sign(float16 a, int sign) +{ + return make_float16((float16_val(a) & 0x7fff) | (sign << 15)); +} + /*---------------------------------------------------------------------------- | The pattern for a default generated half-precision NaN. *----------------------------------------------------------------------------*/
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- include/fpu/softfloat.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.15.1