All of lore.kernel.org
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Sebastian Bauer <mail@sebastianbauer.info>,
	Magnus Damm <magnus.damm@gmail.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: [PATCH v2 6/8] sm501: Use stn_he_p/ldn_he_p instead of switch/case
Date: Tue, 16 Jun 2020 02:22:30 +0200	[thread overview]
Message-ID: <59fd9656e72cd56e6dcd3c9ffc04ff91f8b3d907.1592266950.git.balaton@eik.bme.hu> (raw)
In-Reply-To: <cover.1592266950.git.balaton@eik.bme.hu>

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>
---
 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 b6356ea1ee..6e914d3162 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



  reply	other threads:[~2020-06-16  0:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  0:22 [PATCH v2 0/8] More sm501 fixes and optimisations BALATON Zoltan
2020-06-16  0:22 ` BALATON Zoltan [this message]
2020-06-19 10:54   ` [PATCH v2 6/8] sm501: Use stn_he_p/ldn_he_p instead of switch/case Philippe Mathieu-Daudé
2020-06-16  0:22 ` [PATCH v2 2/8] sm501: Drop unneded variable BALATON Zoltan
2020-06-16  0:22 ` [PATCH v2 5/8] sm501: Optimise 1 pixel 2d ops BALATON Zoltan
2020-06-18 16:47   ` Peter Maydell
2020-06-16  0:22 ` [PATCH v2 3/8] sm501: Ignore no-op blits BALATON Zoltan
2020-06-16  0:22 ` [PATCH v2 7/8] sm501: Do not allow guest to set invalid format BALATON Zoltan
2020-06-18 16:43   ` Peter Maydell
2020-06-16  0:22 ` [PATCH v2 1/8] sm501: Fix bounds checks BALATON Zoltan
2020-06-16  0:22 ` [PATCH v2 8/8] sm501: Convert debug printfs to traces BALATON Zoltan
2020-06-18 16:48   ` Peter Maydell
2020-06-16  0:22 ` [PATCH v2 4/8] sm501: Introduce variable for commonly used value for better readability BALATON Zoltan
2020-06-18 16:45   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59fd9656e72cd56e6dcd3c9ffc04ff91f8b3d907.1592266950.git.balaton@eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=aurelien@aurel32.net \
    --cc=kraxel@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=mail@sebastianbauer.info \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.