All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	"Robert P. J. Day" <rpjday@crashcourse.ca>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Make shr to divide by power of 2 (resend)
Date: Mon, 17 Aug 2009 09:15:20 +0200	[thread overview]
Message-ID: <4A890388.8070709@gmail.com> (raw)
In-Reply-To: <20090816091425.GB7968@localdomain.by>

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.

  reply	other threads:[~2009-08-17  7:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-15 13:43 [PATCH] Make shr to divide by power of 2 (resend) Sergey Senozhatsky
2009-08-15 13:48 ` Jiri Slaby
2009-08-15 13:49   ` Robert P. J. Day
2009-08-15 14:12     ` Sergey Senozhatsky
2009-08-15 20:42       ` Jiri Slaby
2009-08-16  9:14         ` Sergey Senozhatsky
2009-08-17  7:15           ` Jiri Slaby [this message]
2009-08-17  7:31             ` Sergey Senozhatsky
2009-08-17  7:48               ` [PATCH 1/1] VIDEO: console, use DIV_ROUND_UP Jiri Slaby
2009-08-17  8:00                 ` Sergey Senozhatsky
2009-08-17  8:00                   ` Jiri Slaby
2009-08-17  8:08                     ` Sergey Senozhatsky
2009-08-17  8:11                       ` Jiri Slaby
2009-08-15 14:26     ` [PATCH] Make shr to divide by power of 2 (resend) Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A890388.8070709@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.