qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 03/13] core/loader: make range overlap check more readable


From: Yao Xingtao
Subject: [PATCH 03/13] core/loader: make range overlap check more readable
Date: Mon, 22 Jul 2024 00:07:32 -0400

use ranges_overlap() instead of open-coding the overlap check to improve
the readability of the code.

Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
---
 hw/core/loader.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/core/loader.c b/hw/core/loader.c
index 31593a117171..dac0df561b16 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -63,6 +63,7 @@
 #include "qemu/cutils.h"
 #include "sysemu/runstate.h"
 #include "tcg/debuginfo.h"
+#include "qemu/range.h"
 
 #include <zlib.h>
 
@@ -1278,7 +1279,8 @@ static bool roms_overlap(Rom *last_rom, Rom *this_rom)
         return false;
     }
     return last_rom->as == this_rom->as &&
-        last_rom->addr + last_rom->romsize > this_rom->addr;
+        ranges_overlap(last_rom->addr, last_rom->romsize,
+                       this_rom->addr, this_rom->romsize);
 }
 
 static const char *rom_as_name(Rom *rom)
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]