diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-09-18 14:53:42 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2012-09-19 21:40:47 +0200 |
commit | eb99c9a993cc45f431a0b755595c8536aa947ace (patch) | |
tree | 603fbaf9eb4da73df8afd1404eb3b9d988d9ee81 /hw/pflash_cfi01.c | |
parent | 262e1eaafabf32d33a9fa0b03b3c8ea426c5ae1b (diff) |
hw/pflash_cfi0[12]: Use host-utils.h ctz32()
Drop the private reimplementation of ctz32() from pflash_cfi0[12]
in favour of using the standard version from host-utils.h.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/pflash_cfi01.c')
-rw-r--r-- | hw/pflash_cfi01.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index d56b51abe6..9c42d3105c 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -41,6 +41,7 @@ #include "block.h" #include "qemu-timer.h" #include "exec-memory.h" +#include "host-utils.h" #define PFLASH_BUG(fmt, ...) \ do { \ @@ -543,42 +544,6 @@ static const MemoryRegionOps pflash_cfi01_ops_le = { .endianness = DEVICE_NATIVE_ENDIAN, }; -/* Count trailing zeroes of a 32 bits quantity */ -static int ctz32 (uint32_t n) -{ - int ret; - - ret = 0; - if (!(n & 0xFFFF)) { - ret += 16; - n = n >> 16; - } - if (!(n & 0xFF)) { - ret += 8; - n = n >> 8; - } - if (!(n & 0xF)) { - ret += 4; - n = n >> 4; - } - if (!(n & 0x3)) { - ret += 2; - n = n >> 2; - } - if (!(n & 0x1)) { - ret++; -#if 0 /* This is not necessary as n is never 0 */ - n = n >> 1; -#endif - } -#if 0 /* This is not necessary as n is never 0 */ - if (!n) - ret++; -#endif - - return ret; -} - pflash_t *pflash_cfi01_register(target_phys_addr_t base, DeviceState *qdev, const char *name, target_phys_addr_t size, |