[PATCH 08/10] fb: Fix build when FB_SHIFT == 6

Adam Jackson ajax at redhat.com
Mon Mar 10 08:04:32 PDT 2014


My goodness the 24bpp code is ugly.  This failed to build:

fbbltone.c:432:6: warning: left shift count >= width of type [enabled by
default]
      C4_24(0, 0), C4_24(1, 0), C4_24(2, 0), C4_24(3, 0),
      ^
fbbltone.c:432:6: error: initializer element is not constant
fbbltone.c:432:6: error: (near initialization for 'fbStipple24Bits[0][0]')

The warning causes the error here, because gcc will rightly refuse to
constprop invalid expressions.  0xffffffU is only uint32_t; when
FB_SHIFT == 6 FbBits is wider than that, so let's always cast up to
FbBits.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 fb/fbbltone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index 434d447..ca94384 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -407,8 +407,8 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
 
 #define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \
 		     (Mask24Pos(x,r) < 0 ? \
-		      0xffffffU >> Mask24Neg (x,r) : \
-		      0xffffffU << Mask24Check(x,r)) : 0)
+		      ((FbBits)0xffffffU) >> Mask24Neg (x,r) : \
+		      ((FbBits)0xffffffU) << Mask24Check(x,r)) : 0)
 
 #define SelMask24(b,n,r)	((((b) >> n) & 1) * Mask24(n,r))
 
-- 
1.8.5.3



More information about the xorg-devel mailing list