Re: Patch to 2.6.8.1-mm2 to allow multiple NMI handlers to be registered

From: Mikael Pettersson
Date: Thu Aug 19 2004 - 11:30:00 EST


Corey Minyard writes:
> > > + /*
> > > + * If the timer has overflowed, this is certainly a watchdog
> > > + * source
> > > + */
> > > + source = (low & (1 << 31)) == 0;
> > > + if (source)
> >
> >Why not "if ((int)low >= 0)"?
> >
> >
> IIRC, the docs state that timer goes off if the high bit is cleared in
> the register. I was just going with the documentation description. Not
> a big deal either way, I don't think.

Which is the same as saying it occurs on the negative-to-non-negative
transition. The "if ((int)low >= 0)" test is just a test and branch
on sign, while your original requires either a (microcoded?) bit op,
or constructing a large-magnitude mask, followed by some tests.

Yes this is a micro-optimisation, but I find it actually simplifies the code.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/