Commit bb7e729397dc6e6f3147235feb8cda3b229355b0

Authored by aurel32
1 parent a013cc65

hw/apic.c: use functions from host-utils.h

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

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5469 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 3 additions and 35 deletions
hw/apic.c
... ... @@ -20,7 +20,7 @@
20 20 #include "hw.h"
21 21 #include "pc.h"
22 22 #include "qemu-timer.h"
23   -#include "osdep.h"
  23 +#include "host-utils.h"
24 24  
25 25 //#define DEBUG_APIC
26 26 //#define DEBUG_IOAPIC
... ... @@ -108,45 +108,13 @@ static void apic_update_irq(APICState *s);
108 108 /* Find first bit starting from msb */
109 109 static int fls_bit(uint32_t value)
110 110 {
111   -#if QEMU_GNUC_PREREQ(3, 4)
112   - return 31 - __builtin_clz(value);
113   -#else
114   - unsigned int ret = 0;
115   -
116   - if (value > 0xffff)
117   - value >>= 16, ret = 16;
118   - if (value > 0xff)
119   - value >>= 8, ret += 8;
120   - if (value > 0xf)
121   - value >>= 4, ret += 4;
122   - if (value > 0x3)
123   - value >>= 2, ret += 2;
124   - return ret + (value >> 1);
125   -#endif
  111 + return 31 - clz32(value);
126 112 }
127 113  
128 114 /* Find first bit starting from lsb */
129 115 static int ffs_bit(uint32_t value)
130 116 {
131   -#if QEMU_GNUC_PREREQ(3, 4)
132   - return __builtin_ffs(value) - 1;
133   -#else
134   - unsigned int ret = 0;
135   -
136   - if (!value)
137   - return 0;
138   - if (!(value & 0xffff))
139   - value >>= 16, ret = 16;
140   - if (!(value & 0xff))
141   - value >>= 8, ret += 8;
142   - if (!(value & 0xf))
143   - value >>= 4, ret += 4;
144   - if (!(value & 0x3))
145   - value >>= 2, ret += 2;
146   - if (!(value & 0x1))
147   - ret++;
148   - return ret;
149   -#endif
  117 + return ctz32(value);
150 118 }
151 119  
152 120 static inline void set_bit(uint32_t *tab, int index)
... ...