X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=include%2Fmath-emu%2Fop-common.h;h=fd882261225e793c9c08718faf9467d15b3bfea8;hb=12ff4bf58b64ad3b8fb8e27889c99dcd5aa6fb0b;hp=cc1ec396f8d61bcc6e82e851845184011d467eb6;hpb=71c21b4cf62177a9d1ea46ff4c6073c907122226;p=mv-sheeva.git diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h index cc1ec396f8d..fd882261225 100644 --- a/include/math-emu/op-common.h +++ b/include/math-emu/op-common.h @@ -29,7 +29,7 @@ _FP_FRAC_DECL_##wc(X) /* - * Finish truely unpacking a native fp value by classifying the kind + * Finish truly unpacking a native fp value by classifying the kind * of fp value and normalizing both the exponent and the fraction. */ @@ -139,18 +139,27 @@ do { \ if (X##_e <= _FP_WFRACBITS_##fs) \ { \ _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \ - _FP_ROUND(wc, X); \ if (_FP_FRAC_HIGH_##fs(X) \ & (_FP_OVERFLOW_##fs >> 1)) \ { \ X##_e = 1; \ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ - FP_SET_EXCEPTION(FP_EX_INEXACT); \ } \ else \ { \ - X##_e = 0; \ - _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ + _FP_ROUND(wc, X); \ + if (_FP_FRAC_HIGH_##fs(X) \ + & (_FP_OVERFLOW_##fs >> 1)) \ + { \ + X##_e = 1; \ + _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ + FP_SET_EXCEPTION(FP_EX_INEXACT); \ + } \ + else \ + { \ + X##_e = 0; \ + _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ + } \ } \ if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \ (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \ @@ -494,6 +503,8 @@ do { \ R##_c = FP_CLS_NAN; \ _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\ + break; \ + \ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \ R##_s = _FP_NANSIGN_##fs; \ R##_c = FP_CLS_NAN; \