1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix one remaining MSVC warning for 32-bit targets.

One bit shift inside mp_divmod_into gave me "warning C4334: '<<':
result of 32-bit shift implicitly converted to 64 bits". In this case
it was actually on purpose: I intentionally did a shift that I
expected to always fit in a BignumInt, and then I passed the result to
mp_add_integer_into_shifted_by_words() which is general enough that it
wants to accept the biggest integer type it can think of.

It's easy to squelch the warning by using a temporary variable of the
right type. Now I get a warning-clean build on VS2017, for both 64-
and 32-bit.
This commit is contained in:
Simon Tatham 2021-04-18 11:08:27 +01:00
parent c314f58254
commit 3346b4b83f

View File

@ -2145,9 +2145,9 @@ void mp_divmod_into(mp_int *n, mp_int *d, mp_int *q_out, mp_int *r_out)
* Make the constant 2*R, which we'll need in the iteration.
*/
mp_int *two_R = mp_make_sized(rw);
BignumInt top_word = (BignumInt)1 << ((log2_R+1) % BIGNUM_INT_BITS);
mp_add_integer_into_shifted_by_words(
two_R, two_R, (BignumInt)1 << ((log2_R+1) % BIGNUM_INT_BITS),
(log2_R+1) / BIGNUM_INT_BITS);
two_R, two_R, top_word, (log2_R+1) / BIGNUM_INT_BITS);
/*
* Scratch space.