diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2017-06-04 20:26:19 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2017-06-04 20:26:19 +0000 |
commit | 1a11b926c671fa78c976e00ee18f1c7d7490a2d0 (patch) | |
tree | f2dd52b286c5237c77a5c1a66e6fe8873df3b924 /gnu | |
parent | ed582193b23dcf5f0e9bff0f2ec9ed63c46a0f3c (diff) |
Replace ((2 << 31) - 1) with 0xffffffff, which is equivalent but doesn't
cause a shift overflow on a 32-bit arch (i386). ok kettenis@
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c b/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c index 1bfd4670813..5447323e1ce 100644 --- a/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c +++ b/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c @@ -2104,7 +2104,7 @@ optimize_imm () (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000); } if ((i.types[op] & Imm32) - && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1)) + && ((i.op[op].imms->X_add_number & ~(offsetT) 0xffffffffL) == 0)) { i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number @@ -2183,12 +2183,12 @@ optimize_disp () i.types[op] &= ~Disp64; } if ((i.types[op] & Disp32) - && (disp & ~(((offsetT) 2 << 31) - 1)) == 0) + && (disp & ~(offsetT) 0xffffffffL) == 0) { /* If this operand is at most 32 bits, convert to a signed 32 bit number and don't use 64bit displacement. */ - disp &= (((offsetT) 2 << 31) - 1); + disp &= (offsetT) 0xffffffffL; disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); i.types[op] &= ~Disp64; } |