[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A890388.8070709@gmail.com>
Date: Mon, 17 Aug 2009 09:15:20 +0200
From: Jiri Slaby <jirislaby@...il.com>
To: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
CC: Andi Kleen <andi@...stfloor.org>,
"Robert P. J. Day" <rpjday@...shcourse.ca>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Make shr to divide by power of 2 (resend)
On 08/16/2009 11:14 AM, Sergey Senozhatsky wrote:
> There are different shr/shl operations in bitblit.c. Like,
> #1
> cur_height = vc->vc_font.height >> 1
> cur_height = (vc->vc_font.height << 1)/3;
> c |= c >> 1;
> u32 idx = vc->vc_font.width >> 3;
> etc.
>
> So, should I convert it to something like:
Not at all. I was writing about about (X + 7) / 8 [or >> 3] which is
DIV_ROUND_UP(X, 8).
> #2
> cur_height = DIV_XXX(vc->vc_font.height, 2)
> cur_height = DIV_XXX( MUL_XXX(vc->vc_font.height, 2), 3); or cur_height = DIV_XXX( (vc->vc_font.height * 2), 3);
> c |= DIV_XXX(c, 1);
> u32 idx = DIV_XXX(vc->vc_font.width, 8);
>
> #1 is better-looking I think.
Agreed. I would write it without shifts though. But we were talking
about the roundup case not about the shifts all over the code.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists