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? Larry _______________________________________________ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev