]> Git Repo - qemu.git/commitdiff
display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_lin...
authorChen Qun <[email protected]>
Wed, 25 Mar 2020 02:59:18 +0000 (10:59 +0800)
committerLaurent Vivier <[email protected]>
Mon, 4 May 2020 09:17:27 +0000 (11:17 +0200)
Clang static code analyzer show warning:
  hw/display/blizzard.c:940:9: warning: Value stored to 'data' is never read
        data >>= 5;
        ^        ~
Reported-by: Euler Robot <[email protected]>
Signed-off-by: Chen Qun <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20200325025919[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
hw/display/blizzard.c

index 359e399c2a0b2ca548ec75e459aaa92c25cca874..105241577de1e943fcf8a47b5304a6e467fbe569 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/bitops.h"
 #include "ui/console.h"
 #include "hw/display/blizzard.h"
 #include "ui/pixel_ops.h"
@@ -932,12 +933,9 @@ static void blizzard_draw_line16_32(uint32_t *dest,
     const uint16_t *end = (const void *) src + width;
     while (src < end) {
         data = *src ++;
-        b = (data & 0x1f) << 3;
-        data >>= 5;
-        g = (data & 0x3f) << 2;
-        data >>= 6;
-        r = (data & 0x1f) << 3;
-        data >>= 5;
+        b = extract16(data, 0, 5) << 3;
+        g = extract16(data, 5, 6) << 2;
+        r = extract16(data, 11, 5) << 3;
         *dest++ = rgb_to_pixel32(r, g, b);
     }
 }
This page took 0.027626 seconds and 4 git commands to generate.