Skip to content

Commit ba27110

Browse files
zbalatonkraxel
authored andcommitted
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 <[email protected]> Signed-off-by: BALATON Zoltan <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-id: e2f649cb286f0735a10ec87c1b36a7ae081acb61.1592686588.git.balaton@eik.bme.hu Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent c208085 commit ba27110

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

hw/display/sm501.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -766,17 +766,7 @@ static void sm501_2d_operation(SM501State *s)
766766
for (y = 0; y < height; y++) {
767767
i = (dst_x + (dst_y + y) * dst_pitch) * bypp;
768768
for (x = 0; x < width; x++, i += bypp) {
769-
switch (format) {
770-
case 0:
771-
d[i] = ~d[i];
772-
break;
773-
case 1:
774-
*(uint16_t *)&d[i] = ~*(uint16_t *)&d[i];
775-
break;
776-
case 2:
777-
*(uint32_t *)&d[i] = ~*(uint32_t *)&d[i];
778-
break;
779-
}
769+
stn_he_p(&d[i], bypp, ~ldn_he_p(&d[i], bypp));
780770
}
781771
}
782772
} else {

0 commit comments

Comments
 (0)