From: Michael Buesch <mb@bu3sch.de>
To: bcm43xx-dev@lists.berlios.de
Cc: "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 23:32:21 +0100 [thread overview]
Message-ID: <201001102332.22954.mb@bu3sch.de> (raw)
In-Reply-To: <op.u6b70ig59lhzdc@linux-g0th.site>
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.
--
Greetings, Michael.
next prev parent reply other threads:[~2010-01-10 22:32 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 [this message]
2010-01-11 0:27 ` Larry Finger
2010-01-11 0:53 ` Michael Buesch
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=201001102332.22954.mb@bu3sch.de \
--to=mb@bu3sch.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).