On Mon, 10 May 1999, Jon Olson wrote:

> Don't know what you're using, but here's the code that I use in my embedded
> work to find the first IRQ bit in my StrongARM IRQ handler.  I did a bit of work
> on this one and I don't think you can make it much better.  Note that in this
> case, the `sl' register points to a vector of trap handlers, followed by a
> a vector of `this' pointers.

I hasten to alert you to David Seal's trick, then: multiply the word
by 0x0450FBAF and look the top six bits of the result up in a table
(this is for finding the lowest 1 in a word as it stands).

Also, Wilco's similar trick: multiply the word by 0x0FB9AC52 and look
the top six bits up of the result in a similar table (this version
finds trailing zeroes, though).

I think these weigh in at round 11 cycles.

-- 
Chris <[EMAIL PROTECTED]>                         ( http://www.fluff.org/chris )

unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]

Reply via email to