[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/13] display/sm501: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 05/13] display/sm501: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:34 -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/display/sm501.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 26dc8170d89b..c25b2574e447 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -823,15 +823,15 @@ static void sm501_2d_operation(SM501State *s)
}
/* If reverse blit do simple check for overlaps */
if (rtl && src_base == dst_base && src_pitch == dst_pitch) {
- overlap = (src_x < dst_x + width && src_x + width > dst_x &&
- src_y < dst_y + height && src_y + height > dst_y);
+ overlap = (ranges_overlap(src_x, width, dst_x, width) &&
+ ranges_overlap(src_y, height, dst_y, height));
} else if (rtl) {
- unsigned int sb, se, db, de;
+ unsigned int sb, sl, db, dl;
sb = src_base + (src_x + src_y * src_pitch) * bypp;
- se = sb + (width + (height - 1) * src_pitch) * bypp;
+ sl = (width + (height - 1) * src_pitch) * bypp;
db = dst_base + (dst_x + dst_y * dst_pitch) * bypp;
- de = db + (width + (height - 1) * dst_pitch) * bypp;
- overlap = (db < se && sb < de);
+ dl = (width + (height - 1) * dst_pitch) * bypp;
+ overlap = ranges_overlap(sb, sl, db, dl);
}
#ifdef CONFIG_PIXMAN
if (overlap && (s->use_pixman & BIT(2))) {
--
2.41.0
- [PATCH 00/13] make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 01/13] range: Make ranges_overlap() return bool, Yao Xingtao, 2024/07/22
- [PATCH 02/13] arm/boot: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 04/13] cxl/mailbox: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 13/13] block/qcow2-cluster: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 05/13] display/sm501: make range overlap check more readable,
Yao Xingtao <=
- [PATCH 10/13] block/vhdx: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 06/13] aspeed_smc: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 08/13] sparc/ldst_helper: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 11/13] crypto/block-luks: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 09/13] system/memory_mapping: make range overlap check more readable, Yao Xingtao, 2024/07/22