xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 20 08:20:43 UTC 2025
mi/micmap.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
New commits:
commit 7aa1f121e4aeae295fb23acd0d474daad84d4f47
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun May 18 12:25:03 2025 -0700
mi: use common implementation of bit counting function
Reduce a bit of unexplained magic, and use ISA extensions where available
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1984>
diff --git a/mi/micmap.c b/mi/micmap.c
index 1259bbba2..e8b3ad568 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -34,6 +34,7 @@
#include "dix/colormap_priv.h"
#include "mi/mi_priv.h"
+#include "os/osdep.h"
#include "scrnintstr.h"
#include "colormapst.h"
@@ -329,7 +330,6 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
Pixel redMask, Pixel greenMask, Pixel blueMask)
{
miVisualsPtr new, *prev, v;
- int count;
new = malloc(sizeof *new);
if (!new)
@@ -347,10 +347,7 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
new->redMask = redMask;
new->greenMask = greenMask;
new->blueMask = blueMask;
- count = (visuals >> 1) & 033333333333;
- count = visuals - count - ((count >> 1) & 033333333333);
- count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */
- new->count = count;
+ new->count = Ones(visuals);
for (prev = &miVisuals; (v = *prev); prev = &v->next);
*prev = new;
return TRUE;
More information about the xorg-commit
mailing list