SP int: div small static code analysis change

_sp_div_small: Make it explicit as possible that we only want the bottom
digit of the product subtracted from the bottom word of t. Top digit is
unnecessary and more cycles used if calculated.
This commit is contained in:
Sean Parkinson 2023-01-30 08:40:45 +10:00
parent 06509021ff
commit 08afe6a404

View File

@ -6377,7 +6377,7 @@ static void _sp_div_small(const sp_int* a, sp_int_digit d, sp_int* r,
/* Get top digit after multipling. */
tt = (t * m) >> SP_WORD_SIZE;
/* Subtract trial division. */
tr = (sp_int_digit)(t - tt * d);
tr = (sp_int_digit)t - (sp_int_digit)(tt * d);
#else
/* Multiply digit. */
SP_ASM_MUL(l, tt, a->dp[i], m);
@ -6404,7 +6404,7 @@ static void _sp_div_small(const sp_int* a, sp_int_digit d, sp_int* r,
/* Get top digit after multipling. */
tt = (t * m) >> SP_WORD_SIZE;
/* Subtract trial division. */
tr = (sp_int_digit)(t - tt * d);
tr = (sp_int_digit)t - (sp_int_digit)(tt * d);
#else
/* Multiply digit. */
SP_ASM_MUL(l, tt, a->dp[i], m);