[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] target-arm: Use sextract32() in branch deco
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] target-arm: Use sextract32() in branch decode |
Date: |
Fri, 23 Aug 2013 11:09:14 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
On 08/23/2013 09:12 AM, Peter Maydell wrote:
> - offset = (((int32_t)insn << 8) >> 8);
> - val += (offset << 2) + 4;
> + offset = sextract32(insn << 2, 0, 26);
> + val += offset + 4;
I read this incorrectly at first, considering the shift of insn, and
I wonder if it's really the best way to write this because of that.
What about just changing the one line to sextract(insn, 0, 24)?
The second line by itself ought not trigger a warning from clang,
because the << 2 never changes the sign bit. If it still does,
perhaps just multiply by 4 instead...
It's a stupid warning. When was the last ones-compliment machine built?
r~