From: Michael Buesch <mb@bu3sch.de>
To: Larry Finger <Larry.Finger@lwfinger.net>
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: Mon, 11 Jan 2010 01:53:08 +0100 [thread overview]
Message-ID: <201001110153.09503.mb@bu3sch.de> (raw)
In-Reply-To: <4B4A7084.8010309@lwfinger.net>
On Monday 11 January 2010 01:27:48 Larry Finger wrote:
> 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.
>
> We do want sign extension of the signed 6-bit quantities into an 8-bit word. The
> translation is correct. Do you know of a better way to extend the signs?
Well, I think you got the parenthesis and cast wrong then.
I think what we want is the following:
+ buf[3] += (s8)(((s[1] >> 8) & 0x3F) << 2) >> 2;
The code is different and the specs, too.
--
Greetings, Michael.
next prev parent reply other threads:[~2010-01-11 0:53 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 [this message]
2010-01-11 2:38 ` Larry Finger
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=201001110153.09503.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=Larry.Finger@lwfinger.net \
--cc=bcm43xx-dev@lists.berlios.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--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.