All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Michael Buesch <mb@bu3sch.de>
Cc: bcm43xx-dev@lists.berlios.de, "Rafał Miłecki" <zajec5@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [PATCH 2/6] b43: N-PHY: add RSSI functions: poll and set 2055 vcm
Date: Sun, 10 Jan 2010 20:38:53 -0600	[thread overview]
Message-ID: <4B4A8F3D.6010200@lwfinger.net> (raw)
In-Reply-To: <201001102332.22954.mb@bu3sch.de>

On 01/10/2010 04:32 PM, Michael Buesch wrote:
> On Sunday 10 January 2010 23:13:20 Rafał Miłecki wrote:
>> +		buf[0] += (s8)(((s[0] & 0x3F) << 2) >> 2);
>> +		buf[1] += (s8)((((s[0] >> 8) & 0x3F) << 2) >> 2);
>> +		buf[2] += (s8)(((s[1] & 0x3F) << 2) >> 2);
>> +		buf[3] += (s8)((((s[1] >> 8) & 0x3F) << 2) >> 2);
> 
> I suggest buf[3] += (s8)((((s[1] >> 8) & 0x3F) << 2) >> 2) << 2) >> 2) << 2) >> 2) << 2) >> 2) << 2) >> 2) << 2) >> 2) << 2) >> 2)
> ;)
> No, seriously, why shift left and then shift right? Is this a translation error?
> I _guess_ it's some mistranslation of the sign extension going on.
> Or alternatively a compiler going insane on sign extension.
> 
> The question is: Do we want these integers to be signextended or not?
> 
> What we currently do is this:
> buf[3] += (s8)((s[1] >> 8) & 0x3F);
> 
> which will always result in a positive 8bit integer, as far as I can see.
> Which smells fishy.

Yes, my fault. The specs are now corrected so that these statements are

((s8)((s[1] >> 8) & 0x3F) << 2) >> 2

I think that is right.

Larry

  parent reply	other threads:[~2010-01-11  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-10 22:13 [PATCH 2/6] b43: N-PHY: add RSSI functions: poll and set 2055 vcm Rafał Miłecki
2010-01-10 22:32 ` Michael Buesch
2010-01-11  0:27   ` Larry Finger
2010-01-11  0:53     ` Michael Buesch
2010-01-11  2:38   ` Larry Finger [this message]
2010-01-11 10:08     ` Michael Buesch

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=4B4A8F3D.6010200@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mb@bu3sch.de \
    --cc=zajec5@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.