[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 6/9] sm501: Use stn_he_p/ldn_he_p instead of switch/case
From: |
BALATON Zoltan |
Subject: |
[PATCH v3 6/9] sm501: Use stn_he_p/ldn_he_p instead of switch/case |
Date: |
Sat, 20 Jun 2020 22:56:28 +0200 |
Instead of open coding op with different sizes using a switch and type
casting it can be written more compactly using stn_he_p/ldn_he_p.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/display/sm501.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 2098e69810..6349f31e64 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -766,17 +766,7 @@ static void sm501_2d_operation(SM501State *s)
for (y = 0; y < height; y++) {
i = (dst_x + (dst_y + y) * dst_pitch) * bypp;
for (x = 0; x < width; x++, i += bypp) {
- switch (format) {
- case 0:
- d[i] = ~d[i];
- break;
- case 1:
- *(uint16_t *)&d[i] = ~*(uint16_t *)&d[i];
- break;
- case 2:
- *(uint32_t *)&d[i] = ~*(uint32_t *)&d[i];
- break;
- }
+ stn_he_p(&d[i], bypp, ~ldn_he_p(&d[i], bypp));
}
}
} else {
--
2.21.3
- [PATCH v3 0/9] More sm501 fixes and optimisations, BALATON Zoltan, 2020/06/20
- [PATCH v3 5/9] sm501: Optimise 1 pixel 2d ops, BALATON Zoltan, 2020/06/20
- [PATCH v3 4/9] sm501: Introduce variable for commonly used value for better readability, BALATON Zoltan, 2020/06/20
- [PATCH v3 6/9] sm501: Use stn_he_p/ldn_he_p instead of switch/case,
BALATON Zoltan <=
- [PATCH v3 1/9] sm501: Fix bounds checks, BALATON Zoltan, 2020/06/20
- [PATCH v3 7/9] sm501: Do not allow guest to set invalid format, BALATON Zoltan, 2020/06/20
- [PATCH v3 3/9] sm501: Ignore no-op blits, BALATON Zoltan, 2020/06/20
- [PATCH v3 9/9] sm501: Fix and optimize overlap check, BALATON Zoltan, 2020/06/20
- [PATCH v3 2/9] sm501: Drop unneded variable, BALATON Zoltan, 2020/06/20