aboutsummaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2020-06-20 22:56:28 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-06-30 22:46:28 +0200
commitba27110fab0b7ba26ff6a36a7311481181dd83f8 (patch)
treed9b504b61dc76c3113bf6e8e40b2bf939ce17c2b /hw/display
parentc208085a3e979e1da23a59c397ad6ab56a29d7bf (diff)
downloadqemu-ba27110fab0b7ba26ff6a36a7311481181dd83f8.zip
qemu-ba27110fab0b7ba26ff6a36a7311481181dd83f8.tar.gz
qemu-ba27110fab0b7ba26ff6a36a7311481181dd83f8.tar.bz2
sm501: Use stn_he_p/ldn_he_p instead of switch/case
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> Message-id: e2f649cb286f0735a10ec87c1b36a7ae081acb61.1592686588.git.balaton@eik.bme.hu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/sm501.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 2098e69..6349f31 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 {