File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ template <typename T>
6868MLI_FORCE_INLINE T mli_math_asr_rnd_fx (T x, int nbits)
6969{
7070 T r = 0 ;
71+ T one = 1u ;
7172
7273 if (nbits < 0 )
7374 return mli_math_asl_fx<T>(x, (-nbits));
@@ -80,7 +81,7 @@ MLI_FORCE_INLINE T mli_math_asr_rnd_fx(T x, int nbits)
8081 // Rounding up:
8182 // if the most significant deleted bit is 1, add 1 to the remaining bits.
8283#ifdef ROUND_UP
83- T round = (T)((1u << nbits) >> 1 );
84+ T round = (T)((one << nbits) >> 1 );
8485 r = mli_math_add_fx<T>(x, round);
8586 r = mli_math_asr_fx<T>(r, nbits);
8687#endif
@@ -91,7 +92,7 @@ MLI_FORCE_INLINE T mli_math_asr_rnd_fx(T x, int nbits)
9192 // or at least one other deleted bit is 1, add 1 to the remaining bits.
9293#ifdef ROUND_CONVERGENT
9394 r = mli_math_asr_fx<T>(x, nbits);
94- T last_deleted_mask = (T)((1 << nbits) >> 1 );
95+ T last_deleted_mask = (T)((one << nbits) >> 1 );
9596 if (((x & last_deleted_mask) != (T)0 ) &&
9697 (((r & (T)1 ) != (T)0 ) || ((x & (last_deleted_mask-(T)1 ))!= (T)0 ))) {
9798 return mli_math_add_fx<T>(r, 1 );
You can’t perform that action at this time.
0 commit comments