lkml.org 
[lkml]   [2009]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Make shr to divide by power of 2 (resend)
On 08/15/2009 03:43 PM, Sergey Senozhatsky wrote:
> Make an arithmetic right shift to divide by power of 2.

Why? Is out there a compiler not doing that?

Seems like it should be rather converted to DIV_ROUND_UP.

> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
> diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
> index 69864b1..b816151 100644
> --- a/drivers/video/console/bitblit.c
> +++ b/drivers/video/console/bitblit.c
> @@ -144,7 +144,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
> int fg, int bg)
> {
> struct fb_image image;
> - u32 width = (vc->vc_font.width + 7)/8;
> + u32 width = (vc->vc_font.width + 7) >> 3;
> u32 cellsize = width * vc->vc_font.height;
> u32 maxcnt = info->pixmap.size/cellsize;
> u32 scan_align = info->pixmap.scan_align - 1;



\
 
 \ /
  Last update: 2009-08-15 15:51    [W:0.107 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site