[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/10] vnc: replace hweight_long() with ctpopl()
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 10/10] vnc: replace hweight_long() with ctpopl() |
Date: |
Fri, 12 May 2017 13:51:35 +0200 |
From: Cédric Le Goater <address@hidden>
ctpopl() has a better implementation than hweight_long() and ui/vnc.c
being the last user of hweight_long(), we can simply remove it.
Signed-off-by: Cédric Le Goater <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
include/qemu/bitops.h | 10 ----------
ui/vnc.c | 6 +++---
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
index 1881284cb5..3f0926cf40 100644
--- a/include/qemu/bitops.h
+++ b/include/qemu/bitops.h
@@ -201,16 +201,6 @@ static inline unsigned long find_first_zero_bit(const
unsigned long *addr,
return find_next_zero_bit(addr, size, 0);
}
-static inline unsigned long hweight_long(unsigned long w)
-{
- unsigned long count;
-
- for (count = 0; w; w >>= 1) {
- count += w & 1;
- }
- return count;
-}
-
/**
* rol8 - rotate an 8-bit value left
* @word: value to rotate
diff --git a/ui/vnc.c b/ui/vnc.c
index 601f9ec539..47b49c7318 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2061,15 +2061,15 @@ static void set_pixel_format(VncState *vs, int
bits_per_pixel,
}
vs->client_pf.rmax = red_max ? red_max : 0xFF;
- vs->client_pf.rbits = hweight_long(red_max);
+ vs->client_pf.rbits = ctpopl(red_max);
vs->client_pf.rshift = red_shift;
vs->client_pf.rmask = red_max << red_shift;
vs->client_pf.gmax = green_max ? green_max : 0xFF;
- vs->client_pf.gbits = hweight_long(green_max);
+ vs->client_pf.gbits = ctpopl(green_max);
vs->client_pf.gshift = green_shift;
vs->client_pf.gmask = green_max << green_shift;
vs->client_pf.bmax = blue_max ? blue_max : 0xFF;
- vs->client_pf.bbits = hweight_long(blue_max);
+ vs->client_pf.bbits = ctpopl(blue_max);
vs->client_pf.bshift = blue_shift;
vs->client_pf.bmask = blue_max << blue_shift;
vs->client_pf.bits_per_pixel = bits_per_pixel;
--
2.9.3
- [Qemu-devel] [PULL 00/10] ui patch queue, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 06/10] egl-helpers: add missing error check, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 10/10] vnc: replace hweight_long() with ctpopl(),
Gerd Hoffmann <=
- [Qemu-devel] [PULL 02/10] ui: input-linux: Add absolute event support, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 03/10] virtio-gpu: move virtio_gpu_gl_block, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 09/10] vnc: simple clean up, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 08/10] opengl: add egl-headless display, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 07/10] egl: explicitly ask for core context, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 05/10] egl-helpers: fix display init for x11, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 04/10] egl-helpers: drop support for gles and debug logging, Gerd Hoffmann, 2017/05/12
- [Qemu-devel] [PULL 01/10] ui: Support non-zero minimum values for absolute input axes, Gerd Hoffmann, 2017/05/12
- Re: [Qemu-devel] [PULL 00/10] ui patch queue, Stefan Hajnoczi, 2017/05/15