mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 11:04:58 -06:00
tcg-s390: Fix off-by-one in wraparound andi
Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
450445d543
commit
a175689654
1 changed files with 2 additions and 2 deletions
|
@ -983,8 +983,8 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)
|
||||||
int msb, lsb;
|
int msb, lsb;
|
||||||
if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) {
|
if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) {
|
||||||
/* Achieve wraparound by swapping msb and lsb. */
|
/* Achieve wraparound by swapping msb and lsb. */
|
||||||
msb = 63 - ctz64(~val);
|
msb = 64 - ctz64(~val);
|
||||||
lsb = clz64(~val) + 1;
|
lsb = clz64(~val) - 1;
|
||||||
} else {
|
} else {
|
||||||
msb = clz64(val);
|
msb = clz64(val);
|
||||||
lsb = 63 - ctz64(val);
|
lsb = 63 - ctz64(val);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue