Re: svn commit: r288099 - head/contrib/binutils/opcodes
On 22 Sep 2015, at 16:23, Ian Lepore wrote: > > On Tue, 2015-09-22 at 11:53 +0200, Dimitry Andric wrote: >> On 22 Sep 2015, at 11:43, Slawa Olhovchenkov wrote: >>> >>> On Tue, Sep 22, 2015 at 09:35:35AM +, 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 signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r288099 - head/contrib/binutils/opcodes
On Tue, Sep 22, 2015 at 08:23:07AM -0600, Ian Lepore wrote: > On Tue, 2015-09-22 at 11:53 +0200, Dimitry Andric wrote: > > On 22 Sep 2015, at 11:43, Slawa Olhovchenkov wrote: > > > > > > On Tue, Sep 22, 2015 at 09:35:35AM +, 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? "There are no negative integer literals. Expressions such as -1 apply the unary minus operator to the value represented by the literal, which may involve implicit type conversions." ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r288099 - head/contrib/binutils/opcodes
On Tue, 2015-09-22 at 11:53 +0200, Dimitry Andric wrote: > On 22 Sep 2015, at 11:43, Slawa Olhovchenkov wrote: > > > > On Tue, Sep 22, 2015 at 09:35:35AM +, 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? -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r288099 - head/contrib/binutils/opcodes
On Tue, Sep 22, 2015 at 11:53:32AM +0200, Dimitry Andric wrote: > On 22 Sep 2015, at 11:43, Slawa Olhovchenkov wrote: > > > > On Tue, Sep 22, 2015 at 09:35:35AM +, 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. (~0U << 7) ? > (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 > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r288099 - head/contrib/binutils/opcodes
On 22 Sep 2015, at 11:43, Slawa Olhovchenkov wrote: > > On Tue, Sep 22, 2015 at 09:35:35AM +, 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 signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r288099 - head/contrib/binutils/opcodes
On Tue, Sep 22, 2015 at 09:35:35AM +, Dimitry Andric wrote: > Author: dim > Date: Tue Sep 22 09:35:35 2015 > New Revision: 288099 > URL: https://svnweb.freebsd.org/changeset/base/288099 > > Log: > In binutils' arm-dis.c, avoid left-shifting a negative number. > > Submitted by: dan.mcgregor_usask.ca (Dan McGregor) > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D3376 > > Modified: > head/contrib/binutils/opcodes/arm-dis.c > > Modified: head/contrib/binutils/opcodes/arm-dis.c > == > --- head/contrib/binutils/opcodes/arm-dis.c Tue Sep 22 07:40:55 2015 > (r288098) > +++ head/contrib/binutils/opcodes/arm-dis.c Tue Sep 22 09:35:35 2015 > (r288099) > @@ -1767,7 +1767,7 @@ print_insn_coprocessor (bfd_vma pc, stru > > /* Is ``imm'' a negative number? */ > if (imm & 0x40) > - imm |= (-1 << 7); > + imm |= -(1 << 7); May be (~0 << 7) is more simple to understund? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"