leul_to_cpu() is only used within physmem.c: inline it
and remove.
Since @bitmap is of 'unsigned long' type, use its size
with ldn_le_p() instead of using HOST_LONG_BITS.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/bswap.h | 11 -----------
system/physmem.c | 5 +++--
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index dc31d48fd13..98877feffa9 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -315,17 +315,6 @@ static inline void stq_be_p(void *ptr, uint64_t v)
stq_unaligned_p(ptr, be_bswap(v, 64));
}
-static inline unsigned long leul_to_cpu(unsigned long v)
-{
-#if HOST_LONG_BITS == 32
- return le_bswap(v, 32);
-#elif HOST_LONG_BITS == 64
- return le_bswap(v, 64);
-#else
-# error Unknown sizeof long
-#endif
-}
-
/* Store v to p as a sz byte value in host order */
#define DO_STN_LDN_P(END) \
static inline void stn_## END ## _p(void *ptr, int sz, uint64_t v) \
diff --git a/system/physmem.c b/system/physmem.c
index be0c8094736..cd2b0dc5fc2 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -1272,7 +1272,8 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
for (k = 0; k < nr; k++) {
if (bitmap[k]) {
- unsigned long temp = leul_to_cpu(bitmap[k]);
+ unsigned long temp = ldn_le_p(&bitmap[k],
+ sizeof(bitmap[k]));
nbits = ctpopl(temp);
qatomic_or(&blocks[DIRTY_MEMORY_VGA][idx][offset], temp);
@@ -1319,7 +1320,7 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
*/
for (i = 0; i < len; i++) {
if (bitmap[i] != 0) {
- c = leul_to_cpu(bitmap[i]);
+ c = ldn_le_p(&bitmap[i], sizeof(bitmap[i]));
nbits = ctpopl(c);
if (unlikely(global_dirty_tracking & GLOBAL_DIRTY_DIRTY_RATE)) {
total_dirty_pages += nbits;
--
2.52.0