[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 6/8] sm501: Use stn_he_p/ldn_he_p instead of switch/case
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 6/8] sm501: Use stn_he_p/ldn_he_p instead of switch/case |
Date: |
Fri, 19 Jun 2020 12:54:24 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 6/16/20 2:22 AM, BALATON Zoltan wrote:
> 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 {
>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
- [PATCH v2 0/8] More sm501 fixes and optimisations, BALATON Zoltan, 2020/06/15
- [PATCH v2 2/8] sm501: Drop unneded variable, BALATON Zoltan, 2020/06/15
- [PATCH v2 4/8] sm501: Introduce variable for commonly used value for better readability, BALATON Zoltan, 2020/06/15
- [PATCH v2 5/8] sm501: Optimise 1 pixel 2d ops, BALATON Zoltan, 2020/06/15
- [PATCH v2 3/8] sm501: Ignore no-op blits, BALATON Zoltan, 2020/06/15
- [PATCH v2 8/8] sm501: Convert debug printfs to traces, BALATON Zoltan, 2020/06/15
- [PATCH v2 6/8] sm501: Use stn_he_p/ldn_he_p instead of switch/case, BALATON Zoltan, 2020/06/15
- Re: [PATCH v2 6/8] sm501: Use stn_he_p/ldn_he_p instead of switch/case,
Philippe Mathieu-Daudé <=
- [PATCH v2 7/8] sm501: Do not allow guest to set invalid format, BALATON Zoltan, 2020/06/15
- [PATCH v2 1/8] sm501: Fix bounds checks, BALATON Zoltan, 2020/06/15