refactor: Make 64-bit shift explicit
This change fixes MSVC level-3 warning C4334. See: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334 Required to enable level 3 warnings (/W3).
This commit is contained in:
parent
b2e29e43d0
commit
d1e48e5474
@ -683,7 +683,7 @@ static int secp256k1_ecmult_pippenger_batch(const secp256k1_callback* error_call
|
|||||||
}
|
}
|
||||||
state_space->ps = (struct secp256k1_pippenger_point_state *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*state_space->ps));
|
state_space->ps = (struct secp256k1_pippenger_point_state *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*state_space->ps));
|
||||||
state_space->wnaf_na = (int *) secp256k1_scratch_alloc(error_callback, scratch, entries*(WNAF_SIZE(bucket_window+1)) * sizeof(int));
|
state_space->wnaf_na = (int *) secp256k1_scratch_alloc(error_callback, scratch, entries*(WNAF_SIZE(bucket_window+1)) * sizeof(int));
|
||||||
buckets = (secp256k1_gej *) secp256k1_scratch_alloc(error_callback, scratch, (1<<bucket_window) * sizeof(*buckets));
|
buckets = (secp256k1_gej *) secp256k1_scratch_alloc(error_callback, scratch, ((size_t)1 << bucket_window) * sizeof(*buckets));
|
||||||
if (state_space->ps == NULL || state_space->wnaf_na == NULL || buckets == NULL) {
|
if (state_space->ps == NULL || state_space->wnaf_na == NULL || buckets == NULL) {
|
||||||
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2221,7 +2221,7 @@ static void scalar_test(void) {
|
|||||||
for (i = 0; i < 100; ++i) {
|
for (i = 0; i < 100; ++i) {
|
||||||
int low;
|
int low;
|
||||||
int shift = 1 + secp256k1_testrand_int(15);
|
int shift = 1 + secp256k1_testrand_int(15);
|
||||||
int expected = r.d[0] % (1 << shift);
|
int expected = r.d[0] % (1ULL << shift);
|
||||||
low = secp256k1_scalar_shr_int(&r, shift);
|
low = secp256k1_scalar_shr_int(&r, shift);
|
||||||
CHECK(expected == low);
|
CHECK(expected == low);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user