|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [PATCH V3 2/7] nios2: Add architecture emulation support |
Date: | Wed, 19 Oct 2016 22:05:59 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/19/2016 08:01 PM, Marek Vasut wrote:
> You might like 0xfffffffc better, but that does require that you count > f's appropriately for the type. That's why I like -4: it's obvious (or > should be) that it masks to a multiple of 4, and type promotion extends > bits to the left as needed for the type of the other AND argument.But then you can also use ~3 , right ?
Yes.
In which case, you'd avoid doing bitwise operations with negative numbers, which is nice.
Eh. Since ~3 == -4, ~3 is a negative number. So it's a false argument.(C triviallities aside, such as the fact that there are no negative constants, only positive constants to which unary negation may be applied.)
The reason I like -4 is that it aligns to 4, spelled the same way. r~
[Prev in Thread] | Current Thread | [Next in Thread] |