[Nouveau] [PATCH 8/8] drm/nouveau: remove mask in nv04_fbcon_imageblit()

Pekka Paalanen pq at iki.fi
Mon Aug 17 06:42:44 PDT 2009


The local variable 'mask' is simply confusing, the value is equivalent
to zero.

Why? The literal 0 is by default signed. So is ~0. Bitshift to right of
a signed type is implementation defined, gcc replicates the sign bit.
Therefore ~0 >> x equals always ~0, and the final 'mask' value is 0.

Remove this obfuscation.

Signed-off-by: Pekka Paalanen <pq at iki.fi>
---
 drivers/gpu/drm/nouveau/nv04_fbcon.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c
index 14fc87f..3d19492 100644
--- a/drivers/gpu/drm/nouveau/nv04_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c
@@ -96,7 +96,6 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
 	struct nouveau_channel *chan = dev_priv->channel;
 	uint32_t fg;
 	uint32_t bg;
-	uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel));
 	uint32_t dsize;
 	uint32_t width;
 	uint32_t *data = (uint32_t *)image->data;
@@ -119,8 +118,8 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
 	width = (image->width + 31) & ~31;
 	dsize = (width * image->height) >> 5;
 
-	fg = ((uint32_t *) info->pseudo_palette)[image->fg_color] | mask;
-	bg = ((uint32_t *) info->pseudo_palette)[image->bg_color] | mask;
+	fg = ((uint32_t *) info->pseudo_palette)[image->fg_color];
+	bg = ((uint32_t *) info->pseudo_palette)[image->bg_color];
 
 	BEGIN_RING(chan, NvSubGdiRect, 0x0be4, 7);
 	OUT_RING  (chan, (image->dy << 16) | (image->dx & 0xffff));
-- 
1.6.3.3



More information about the Nouveau mailing list