summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-10-15 13:01:27 -0400
committerAdam Jackson <ajax@redhat.com>2019-10-15 14:05:58 -0400
commit3671a3ee88dac3cf1a301adf27dc2b43b069815b (patch)
tree462e77aaa73d7da9c009436d567ad1ece8d851e9 /mi
parenta41d45eedc0c217c28def47acbd8759e31706b96 (diff)
mi: Fix undefined shift in miSetVisualTypesAndMasks
The masks we end up building will occupy all 32 bits of an unsigned int, which means we had better build the shifts out of unsigned ints, because left-shifting a signed int all the way into the sign bit is undefined.
Diffstat (limited to 'mi')
-rw-r--r--mi/micmap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mi/micmap.c b/mi/micmap.c
index 5743adb19..8b7ecd27f 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -278,14 +278,14 @@ miCreateDefColormap(ScreenPtr pScreen)
#define _RZ(d) ((d + 2) / 3)
#define _RS(d) 0
-#define _RM(d) ((1 << _RZ(d)) - 1)
+#define _RM(d) ((1U << _RZ(d)) - 1)
#define _GZ(d) ((d - _RZ(d) + 1) / 2)
#define _GS(d) _RZ(d)
-#define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d))
+#define _GM(d) (((1U << _GZ(d)) - 1) << _GS(d))
#define _BZ(d) (d - _RZ(d) - _GZ(d))
#define _BS(d) (_RZ(d) + _GZ(d))
-#define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d))
-#define _CE(d) (1 << _RZ(d))
+#define _BM(d) (((1U << _BZ(d)) - 1) << _BS(d))
+#define _CE(d) (1U << _RZ(d))
typedef struct _miVisuals {
struct _miVisuals *next;