Skip to content

Commit 308e43e

Browse files
committed
Fixes a UB on shifts during root refinement
1 parent bfd2340 commit 308e43e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/usolve/refine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static void refine_root_by_N_positive_k(mpz_t *upol, unsigned long int *deg_ptr,
287287

288288
mpz_set(*vala, *tmpvala);
289289
mpz_set(*valb, *tmpvalb);
290-
int64_t maxindex = (1L<<(Nlog));
290+
int64_t maxindex = (Nlog >= 64) ? 1 : (INT64_C(1) << Nlog);
291291

292292
if(index == -2 || index == 0 || (LOG2(index) > Nlog && index > 0) ){
293293
if(Nlog == 2) index = 2;

0 commit comments

Comments
 (0)