Re: Converting register val to IRQ no



I assume You are looking for a !very fast! code and
simple bit scanning for some reason does not satisfy you.
Some CPUs have a special instruction for this
but note this can be used if !only one! bit is set at
a time.

Personally i use the following code and it works
just nice:

INT WhichBit32(UINT value)
{
INT bit = 0;
while (bit < 32)
{
if (value & (1 << bit))
return bit;
}

return -1;
}

Of course there are better solutions like
first checking which half-word is nonzero,
then which half-byte is nonzero and then
just several comparison. But in the most cases
several additional instructions does not make
the weather.



"ms" <ms@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:u0Kods6kFHA.3960@xxxxxxxxxxxxxxxxxxxxxxx
> Hi, I am writing the OEMInterruptHandler function in my OAL. I am following
> PQ model.
> I would like to convert the register value in my interrupt pending register
> to a decimal value
> = to my IRQ no. so i can then use the OalIntrStaticTranslate function on the
> IRQ.
> If i have a value in my register ie 0x80000000 which is equal to IRQ 32 is
> there some
> simple C code to convert this value to 32.
>
> Regards
> ms
>
>
>
>


.



Relevant Pages

  • Converting register val to IRQ no
    ... I am writing the OEMInterruptHandler function in my OAL. ... I would like to convert the register value in my interrupt pending register ... = to my IRQ no. so i can then use the OalIntrStaticTranslate function on the ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Converting register val to IRQ no
    ... INT WhichBit32 ... I am writing the OEMInterruptHandler function in my OAL. ... >> I would like to convert the register value in my interrupt pending register ... >> IRQ. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: problems getting SMP to work with vanilla 2.4.26
    ... PCI: PCI BIOS revision 2.10 entry at 0xf0d00, ... usbcore: registered new driver usbfs ... PCI Interrupt Link enabled at IRQ 11 ...
    (Linux-Kernel)
  • Irq balancing problem?
    ... then I also disabled the user-space irq balancing daemon (in ... CPU: After generic identify, caps: bfebfbff ... PCI: PCI BIOS revision 2.10 entry at 0xfd8d5, ...
    (Linux-Kernel)
  • Re: 3C905 and ethtool
    ... Using 1 I/O APICs ... number of MP IRQ sources: ... matroxfb: ...
    (Linux-Kernel)