Commit 9c504696 authored by Dave Cheney's avatar Dave Cheney

cmd/gc: fix undefined behaviour warnings in mparith3.c

Update #8527

Fixes two warnings:

src/cmd/gc/mparith3.c:255:10: runtime error: shift exponent 52 is too large for 32-bit type 'int'
src/cmd/gc/mparith3.c:254:14: runtime error: shift exponent 52 is too large for 32-bit type 'int'

LGTM=rsc
R=r, dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/134940044
parent 1660ece7
......@@ -251,8 +251,8 @@ mpgetfltN(Mpflt *a, int prec, int bias)
s = minexp - e;
if(s > prec+1)
s = prec+1;
if((v & ((1<<s)-1)) != 0)
v |= 1<<s;
if((v & ((1ULL<<s)-1)) != 0)
v |= 1ULL<<s;
v >>= s;
e = minexp;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment