svn commit: r288099 - head/contrib/binutils/opcodes

Dimitry Andric dim at FreeBSD.org
Tue Sep 22 17:46:34 UTC 2015


On 22 Sep 2015, at 16:23, Ian Lepore <ian at FreeBSD.org> wrote:
> 
> On Tue, 2015-09-22 at 11:53 +0200, Dimitry Andric wrote:
>> On 22 Sep 2015, at 11:43, Slawa Olhovchenkov <slw at zxy.spb.ru> wrote:
>>> 
>>> On Tue, Sep 22, 2015 at 09:35:35AM +0000, Dimitry Andric wrote:
>> ...
>>>> -			  imm |= (-1 << 7);
>>>> +			  imm |= -(1 << 7);
>>> 
>>> May be (~0 << 7) is more simple to understund?
>> 
>> This will give the same warning.  ~0 will implicitly convert to -1.
>> 
>> (It would be better to convert all these masks to unsigned, where such
>> shifting is always defined, but that gives a lot more churn.)
>> 
>> -Dimitry
>> 
> 
> How is (-1U << 7) more churn?

For this one line, it isn't, of course.  Writing -(1 << 7) is simply my
personal preference, and it matches the type of 'imm'.  But what I meant
was changing all mask-containing int variables to unsigned, and
suffixing all mask literals U, and so on.  This is what should have been
done by GNU in the first place. :)

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20150922/7ff22890/attachment.bin>


More information about the svn-src-head mailing list