Re: unsigned >= 0 comparisons
On Mon, Jun 25, 2012 at 10:53 PM, Arto Jonsson wrote: > On Mon, Jun 25, 2012 at 01:47:18PM -0600, Theo de Raadt wrote: >> Like, who cares about about commit id's. >> >> Projects are just people working together. A project didn't come up >> with that diff. A person did. >> >> When we say where something came from, we do it by giving credit, not >> by referencing some thing which will go away. > > Agreed, updated: Can this go in? cheers, david > Remove >= 0 comparisons on unsigned integers. > > Diff by oga at nicotinebsd org > > Index: sys/arch/amd64/amd64/machdep.c > === > RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v > retrieving revision 1.155 > diff -u -r1.155 machdep.c > --- sys/arch/amd64/amd64/machdep.c 4 Jun 2012 15:19:47 - 1.155 > +++ sys/arch/amd64/amd64/machdep.c 25 Jun 2012 18:38:30 - > @@ -1652,7 +1652,7 @@ > return 1; > > /* Low memory used for various bootstrap things */ > - if (addr >= 0 && addr < avail_start) > + if (addr < avail_start) > return 1; > > /* > Index: sys/dev/ic/malo.c > === > RCS file: /cvs/src/sys/dev/ic/malo.c,v > retrieving revision 1.93 > diff -u -r1.93 malo.c > --- sys/dev/ic/malo.c 3 Jul 2011 21:35:38 - 1.93 > +++ sys/dev/ic/malo.c 25 Jun 2012 18:38:31 - > @@ -2216,9 +2216,9 @@ > > bzero(body, sizeof(*body)); > body->action = htole16(1); > - if (powerlevel >= 0 && powerlevel < 30) > + if (powerlevel < 30) > body->supportpowerlvl = htole16(5); /* LOW */ > - else if (powerlevel >= 30 && powerlevel < 60) > + else if (powerlevel < 60) > body->supportpowerlvl = htole16(10);/* MEDIUM */ > else > body->supportpowerlvl = htole16(15);/* HIGH */
Re: unsigned >= 0 comparisons
On Mon, Jun 25, 2012 at 01:47:18PM -0600, Theo de Raadt wrote: > Like, who cares about about commit id's. > > Projects are just people working together. A project didn't come up > with that diff. A person did. > > When we say where something came from, we do it by giving credit, not > by referencing some thing which will go away. Agreed, updated: Remove >= 0 comparisons on unsigned integers. Diff by oga at nicotinebsd org Index: sys/arch/amd64/amd64/machdep.c === RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v retrieving revision 1.155 diff -u -r1.155 machdep.c --- sys/arch/amd64/amd64/machdep.c 4 Jun 2012 15:19:47 - 1.155 +++ sys/arch/amd64/amd64/machdep.c 25 Jun 2012 18:38:30 - @@ -1652,7 +1652,7 @@ return 1; /* Low memory used for various bootstrap things */ - if (addr >= 0 && addr < avail_start) + if (addr < avail_start) return 1; /* Index: sys/dev/ic/malo.c === RCS file: /cvs/src/sys/dev/ic/malo.c,v retrieving revision 1.93 diff -u -r1.93 malo.c --- sys/dev/ic/malo.c 3 Jul 2011 21:35:38 - 1.93 +++ sys/dev/ic/malo.c 25 Jun 2012 18:38:31 - @@ -2216,9 +2216,9 @@ bzero(body, sizeof(*body)); body->action = htole16(1); - if (powerlevel >= 0 && powerlevel < 30) + if (powerlevel < 30) body->supportpowerlvl = htole16(5); /* LOW */ - else if (powerlevel >= 30 && powerlevel < 60) + else if (powerlevel < 60) body->supportpowerlvl = htole16(10);/* MEDIUM */ else body->supportpowerlvl = htole16(15);/* HIGH */
Re: unsigned >= 0 comparisons
> On Mon, Jun 25, 2012 at 03:12:52PM -0400, Ted Unangst wrote: > > This is a little meta, but if we're going to start pulling changes from > > bitrig, I don't think "commit 171e1f9d" is the attribution style we > > should use. > > It seems that that the branch I took these from is rebased and thus the > commit ids are now incorrect. So if a commit id is referenced it should > be referenced in a branch that doesn't get rebased (probably master in > this case). Like, who cares about about commit id's. Projects are just people working together. A project didn't come up with that diff. A person did. When we say where something came from, we do it by giving credit, not by referencing some thing which will go away.
Re: unsigned >= 0 comparisons
On Mon, Jun 25, 2012 at 03:12:52PM -0400, Ted Unangst wrote: > This is a little meta, but if we're going to start pulling changes from > bitrig, I don't think "commit 171e1f9d" is the attribution style we > should use. It seems that that the branch I took these from is rebased and thus the commit ids are now incorrect. So if a commit id is referenced it should be referenced in a branch that doesn't get rebased (probably master in this case). -- Arto Jonsson
Re: unsigned >= 0 comparisons
On Mon, Jun 25, 2012 at 20:54, Arto Jonsson wrote: > Hi, > > a couple of >= 0 comparisons on unsigned integers. These refer to Bitrig > commits 171e1f9d and 72337965 respectively. This is a little meta, but if we're going to start pulling changes from bitrig, I don't think "commit 171e1f9d" is the attribution style we should use.
Re: unsigned >= 0 comparisons
On Mon, Jun 25, 2012 at 07:23:44PM +0100, Nigel Taylor wrote: > In place of > else if (powerlevel >= 30 && powerlevel < 60) > could use > else if (powerlevel < 60) > Thanks. Updated patch below. Index: sys/arch/amd64/amd64/machdep.c === RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v retrieving revision 1.155 diff -u -r1.155 machdep.c --- sys/arch/amd64/amd64/machdep.c 4 Jun 2012 15:19:47 - 1.155 +++ sys/arch/amd64/amd64/machdep.c 25 Jun 2012 18:38:30 - @@ -1652,7 +1652,7 @@ return 1; /* Low memory used for various bootstrap things */ - if (addr >= 0 && addr < avail_start) + if (addr < avail_start) return 1; /* Index: sys/dev/ic/malo.c === RCS file: /cvs/src/sys/dev/ic/malo.c,v retrieving revision 1.93 diff -u -r1.93 malo.c --- sys/dev/ic/malo.c 3 Jul 2011 21:35:38 - 1.93 +++ sys/dev/ic/malo.c 25 Jun 2012 18:38:31 - @@ -2216,9 +2216,9 @@ bzero(body, sizeof(*body)); body->action = htole16(1); - if (powerlevel >= 0 && powerlevel < 30) + if (powerlevel < 30) body->supportpowerlvl = htole16(5); /* LOW */ - else if (powerlevel >= 30 && powerlevel < 60) + else if (powerlevel < 60) body->supportpowerlvl = htole16(10);/* MEDIUM */ else body->supportpowerlvl = htole16(15);/* HIGH */
Re: unsigned >= 0 comparisons
On 06/25/12 18:54, Arto Jonsson wrote: > Hi, > > a couple of >= 0 comparisons on unsigned integers. These refer to Bitrig > commits 171e1f9d and 72337965 respectively. > > Index: sys/arch/amd64/amd64/machdep.c > === > RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v > retrieving revision 1.155 > diff -u -r1.155 machdep.c > --- sys/arch/amd64/amd64/machdep.c4 Jun 2012 15:19:47 - 1.155 > +++ sys/arch/amd64/amd64/machdep.c25 Jun 2012 17:28:29 - > @@ -1652,7 +1652,7 @@ > return 1; > > /* Low memory used for various bootstrap things */ > - if (addr >= 0 && addr < avail_start) > + if (addr < avail_start) > return 1; > > /* > Index: sys/dev/ic/malo.c > === > RCS file: /cvs/src/sys/dev/ic/malo.c,v > retrieving revision 1.93 > diff -u -r1.93 malo.c > --- sys/dev/ic/malo.c 3 Jul 2011 21:35:38 - 1.93 > +++ sys/dev/ic/malo.c 25 Jun 2012 17:28:30 - > @@ -2216,7 +2216,7 @@ > > bzero(body, sizeof(*body)); > body->action = htole16(1); > - if (powerlevel >= 0 && powerlevel < 30) > + if (powerlevel < 30) > body->supportpowerlvl = htole16(5); /* LOW */ > else if (powerlevel >= 30 && powerlevel < 60) > body->supportpowerlvl = htole16(10);/* MEDIUM */ > > In place of else if (powerlevel >= 30 && powerlevel < 60) could use else if (powerlevel < 60)
unsigned >= 0 comparisons
Hi, a couple of >= 0 comparisons on unsigned integers. These refer to Bitrig commits 171e1f9d and 72337965 respectively. Index: sys/arch/amd64/amd64/machdep.c === RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v retrieving revision 1.155 diff -u -r1.155 machdep.c --- sys/arch/amd64/amd64/machdep.c 4 Jun 2012 15:19:47 - 1.155 +++ sys/arch/amd64/amd64/machdep.c 25 Jun 2012 17:28:29 - @@ -1652,7 +1652,7 @@ return 1; /* Low memory used for various bootstrap things */ - if (addr >= 0 && addr < avail_start) + if (addr < avail_start) return 1; /* Index: sys/dev/ic/malo.c === RCS file: /cvs/src/sys/dev/ic/malo.c,v retrieving revision 1.93 diff -u -r1.93 malo.c --- sys/dev/ic/malo.c 3 Jul 2011 21:35:38 - 1.93 +++ sys/dev/ic/malo.c 25 Jun 2012 17:28:30 - @@ -2216,7 +2216,7 @@ bzero(body, sizeof(*body)); body->action = htole16(1); - if (powerlevel >= 0 && powerlevel < 30) + if (powerlevel < 30) body->supportpowerlvl = htole16(5); /* LOW */ else if (powerlevel >= 30 && powerlevel < 60) body->supportpowerlvl = htole16(10);/* MEDIUM */