From: Andy Green <andy@warmcat.com>
To: Larry Finger <larry.finger@lwfinger.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] bcm43xx-mac80211: Rescale link quality output
Date: Sun, 05 Aug 2007 08:31:34 +0100 [thread overview]
Message-ID: <46B57CD6.6060603@warmcat.com> (raw)
In-Reply-To: <46B57BA8.5010102@lwfinger.net>
Somebody in the thread at some point said:
> Andy Green wrote:
>> Somebody in the thread at some point said:
>>> BCM43xx_RX_MAX_SSI (60)
>>
>>> + status.signal = jssi * 100 / BCM43xx_RX_MAX_SSI;
>>
>> That can't be doing what you intended... (int)100/60 == 1, it just
>> multiplies jssi by 1. Maybe some brackets around the multiply?
>
> I think gcc does equal rank operations from left to right, and the
> change does have the desired result, but the parentheses should be there
> for clarity.
Man I don't know when * started to have equal precedence to /, but you
are right:
#include <stdio.h>
main()
{
printf("%d\n", 5 * 100 / 60);
printf("%d\n", (5 * 100) / 60);
printf("%d\n", 5 * (100 / 60));
}
$ gcc test.c -o test
$ ./test
8
8
5
Sorry for the noise.
-Andy
prev parent reply other threads:[~2007-08-05 7:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 6:23 [PATCH] bcm43xx-mac80211: Rescale link quality output Larry Finger
2007-08-05 6:43 ` Andy Green
2007-08-05 7:26 ` Larry Finger
2007-08-05 7:31 ` Andy Green [this message]
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=46B57CD6.6060603@warmcat.com \
--to=andy@warmcat.com \
--cc=larry.finger@lwfinger.net \
--cc=linux-wireless@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).