ffs(3) returns the bit index, not the bit value, and the right-most bit
is index 1. So you need to use
addrs &= ~(1 << (i - 1));
rather than
+ addrs &= ~i;
:)
You could also use
while ((i = ffs(addrs)) != 0) {
...
}
instead of the f
On Wed, Jan 27, 2016 at 08:33:55PM +0100, Martin Husemann wrote:
> On Wed, Jan 27, 2016 at 07:53:27PM +0100, Martin Husemann wrote:
> > How about defining a RTA_ALL_MASK (or however we'd call it, defined as
> > 0x1ff) and write:
> >
> > for (i = 1; i & RTA_ALL_MASK; i <<= 1) {
> >
> > ?
>
>
On Wed, Jan 27, 2016 at 07:53:27PM +0100, Martin Husemann wrote:
> How about defining a RTA_ALL_MASK (or however we'd call it, defined as
> 0x1ff) and write:
>
> for (i = 1; i & RTA_ALL_MASK; i <<= 1) {
>
> ?
Or without global header changes, just use ffs() ?
Martin
Index: ifwatchd.c
===
On Wed, Jan 27, 2016 at 12:37:07PM -0500, Michael McConville wrote:
> I think my analysis here applies to this instance as well:
>
> https://marc.info/?l=openbsd-tech&m=145377854103866&w=2
>
> I also changed the chained condition to a switch statement because I
> find that more readable.
Yeah, c
I think my analysis here applies to this instance as well:
https://marc.info/?l=openbsd-tech&m=145377854103866&w=2
I also changed the chained condition to a switch statement because I
find that more readable.
Thanks for your time,
Michael
Index: ifwatchd.c
=