Search Linux Wireless

Re: [PATCH 2/6] b43: N-PHY: add RSSI functions: poll and set 2055 vcm

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

 



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.
--
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