Commit d34ca5901630dca45f105bbe1a80b51fbb8c4284

Authored by aurel32
1 parent d096ab91

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>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5876 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 1 additions and 7 deletions
hw/apic.c
@@ -105,12 +105,6 @@ static void apic_init_ipi(APICState *s); @@ -105,12 +105,6 @@ static void apic_init_ipi(APICState *s);
105 static void apic_set_irq(APICState *s, int vector_num, int trigger_mode); 105 static void apic_set_irq(APICState *s, int vector_num, int trigger_mode);
106 static void apic_update_irq(APICState *s); 106 static void apic_update_irq(APICState *s);
107 107
108 -/* Find first bit starting from msb */  
109 -static int fls_bit(uint32_t value)  
110 -{  
111 - return 31 - clz32(value);  
112 -}  
113 -  
114 /* Find first bit starting from lsb */ 108 /* Find first bit starting from lsb */
115 static int ffs_bit(uint32_t value) 109 static int ffs_bit(uint32_t value)
116 { 110 {
@@ -306,7 +300,7 @@ static int get_highest_priority_int(uint32_t *tab) @@ -306,7 +300,7 @@ static int get_highest_priority_int(uint32_t *tab)
306 int i; 300 int i;
307 for(i = 7; i >= 0; i--) { 301 for(i = 7; i >= 0; i--) {
308 if (tab[i] != 0) { 302 if (tab[i] != 0) {
309 - return i * 32 + fls_bit(tab[i]); 303 + return i * 32 + fls(tab[i]);
310 } 304 }
311 } 305 }
312 return -1; 306 return -1;