public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Justin Madru <jdm64@gawab.com>
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de, error27@gmail.com,
	ray-lk@madrabbit.org
Subject: Re: [PATCH] staging: s5k3e2fx.c: simplify complexity by factoring
Date: Fri, 18 Dec 2009 10:41:46 -0800	[thread overview]
Message-ID: <20091218184146.GE2909@kroah.com> (raw)
In-Reply-To: <1260910330-3409-1-git-send-email-jdm64@gawab.com>

On Tue, Dec 15, 2009 at 12:52:10PM -0800, Justin Madru wrote:
> the code was looping, seting s_move[i] to the following calculations
> 
> if (actual_step >= 0)
>         s_move[i] = ((((i + 1) * gain + 0x200) - (i * gain + 0x200)) / 0x400);
> else
>         s_move[i] = ((((i + 1) * gain - 0x200) - (i * gain - 0x200)) / 0x400);
> 
> but, this code redues to the expression
> 	s_move[i] = gain >> 10;
> 
> The reason for the complexity was to generate a step function with
> integer division and rounding to land on specific values. But these calculations
> can be simplified to the following code:
> 
> 	gain = ((actual_step << 10) / 5) >> 10;
> 	for (i = 0; i <= 4; i++)
> 		s_move[i] = gain;

Care to resend this with a Signed-off-by: line, and add the reviewed-by
line that was requested by Ray?

thanks,

greg k-h

  parent reply	other threads:[~2009-12-18 19:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15 20:52 [PATCH] staging: s5k3e2fx.c: simplify complexity by factoring Justin Madru
2009-12-16 17:09 ` Ray Lee
2009-12-18 18:41 ` Greg KH [this message]
2009-12-18 23:52   ` Justin Madru

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=20091218184146.GE2909@kroah.com \
    --to=greg@kroah.com \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jdm64@gawab.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ray-lk@madrabbit.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox