qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5876] hw/apic.c: use fls() from host-utils
@ 2008-12-04 20:57 Aurelien Jarno
  2008-12-05 20:39 ` Anthony Liguori
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2008-12-04 20:57 UTC (permalink / raw)
  To: qemu-devel

Revision: 5876
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5876
Author:   aurel32
Date:     2008-12-04 20:57:02 +0000 (Thu, 04 Dec 2008)

Log Message:
-----------
hw/apic.c: use fls() from host-utils

...and fix a bug, the implementation in hw/apic.c was wrong.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/hw/apic.c

Modified: trunk/hw/apic.c
===================================================================
--- trunk/hw/apic.c	2008-12-04 20:35:16 UTC (rev 5875)
+++ trunk/hw/apic.c	2008-12-04 20:57:02 UTC (rev 5876)
@@ -105,12 +105,6 @@
 static void apic_set_irq(APICState *s, int vector_num, int trigger_mode);
 static void apic_update_irq(APICState *s);
 
-/* Find first bit starting from msb */
-static int fls_bit(uint32_t value)
-{
-    return 31 - clz32(value);
-}
-
 /* Find first bit starting from lsb */
 static int ffs_bit(uint32_t value)
 {
@@ -306,7 +300,7 @@
     int i;
     for(i = 7; i >= 0; i--) {
         if (tab[i] != 0) {
-            return i * 32 + fls_bit(tab[i]);
+            return i * 32 + fls(tab[i]);
         }
     }
     return -1;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [5876] hw/apic.c: use fls() from host-utils
  2008-12-04 20:57 [Qemu-devel] [5876] hw/apic.c: use fls() from host-utils Aurelien Jarno
@ 2008-12-05 20:39 ` Anthony Liguori
  2008-12-06 10:48   ` Andreas Färber
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2008-12-05 20:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

Aurelien Jarno wrote:
> Revision: 5876
>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5876
> Author:   aurel32
> Date:     2008-12-04 20:57:02 +0000 (Thu, 04 Dec 2008)
>
> Log Message:
> -----------
> hw/apic.c: use fls() from host-utils
>
> ...and fix a bug, the implementation in hw/apic.c was wrong.
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>   

I just bisected a broken Linux guest to this changeset.  I think it 
should be fls() - 1.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [5876] hw/apic.c: use fls() from host-utils
  2008-12-05 20:39 ` Anthony Liguori
@ 2008-12-06 10:48   ` Andreas Färber
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2008-12-06 10:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno


Am 05.12.2008 um 21:39 schrieb Anthony Liguori:

> Aurelien Jarno wrote:
>> Revision: 5876
>>          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5876
>> Author:   aurel32
>> Date:     2008-12-04 20:57:02 +0000 (Thu, 04 Dec 2008)
>>
>> Log Message:
>> -----------
>> hw/apic.c: use fls() from host-utils
>>
>> ...and fix a bug, the implementation in hw/apic.c was wrong.
>>
>> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>>
>
> I just bisected a broken Linux guest to this changeset.  I think it  
> should be fls() - 1.

That unbreaks Haiku guests as well.

Andreas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-06 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 20:57 [Qemu-devel] [5876] hw/apic.c: use fls() from host-utils Aurelien Jarno
2008-12-05 20:39 ` Anthony Liguori
2008-12-06 10:48   ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).