Search Linux Wireless

Re: [PATCH] bcm43xx-mac80211: Rescale link quality output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux