diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 3a0a72bc3ababc4701b9d9bc3a73b30066dec337..16e9ad99f443a7247226cd48f85f7aeba6cd9eb9 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -2565,6 +2565,54 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */ headroom is introduced into acc */ +#if 1 +Word32 BASOP_Util_Add_Mant32Exp( + Word32 Mant1, + Word16 exp1, + Word32 Mant2, + Word16 exp2, + Word16 *exp_res ) +{ + + Word32 tmp1, tmp2, tmp_res; + Word16 scale_tmp, scale_tmp2, scale_tmp3; + + + if ( Mant1 == 0 ) + { + exp1 = exp2; + move16(); + } + + if ( Mant2 == 0 ) + { + exp2 = exp1; + move16(); + } + + scale_tmp = add( s_max( exp2, exp1 ), 1 ); + tmp1 = L_shl( Mant1, sub( exp1, scale_tmp ) ); + + tmp2 = L_shl( Mant2, sub( exp2, scale_tmp ) ); + tmp_res = L_add( tmp1, tmp2 ); + + scale_tmp2 = norm_l( tmp_res ); + tmp_res = L_shl( tmp_res, scale_tmp2 ); + + scale_tmp3 = 0; + move16(); + + if ( tmp_res != 0 ) + { + scale_tmp3 = sub( scale_tmp, scale_tmp2 ); + } + + *exp_res = scale_tmp3; + move16(); + + return tmp_res; +} +#else #ifdef OPT_2146_BASOP_UTIL_ADD_MANT32EXP Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ ( Word32 a_m, /* i : Mantissa of 1st operand a */ @@ -2630,6 +2678,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ return ( a_m ); } #else + Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ ( Word32 a_m, /* i : Mantissa of 1st operand a */ Word16 a_e, /* i : Exponent of 1st operand a */ @@ -2688,6 +2737,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ return ( L_tmp ); } #endif +#endif static const Word16 shift_lc[] = { 9, 10 };