On 7/6/07, shawn bright <[EMAIL PROTECTED]> wrote: > i have a number 12480 > i have a low byte of 192 and a high byte of 176
Maybe I'm being dense, but that doesn't make any sense at all to me. The high byte of 12480 is 48, and the low byte is 192, isn't it? Because (48 * 256) + 192 = 12480? In your formula ( (176 & 127) * 256 + 192 ) you're only using 7 bits of your high byte. Why are you masking off that last bit? And if you mask it off, how do you expect to recover it going the other direction? I suppose for this particular example, the following would work, but it doesn't seem like what you really are after: >>> n = 12480 >>> low_byte = n & 0xFF >>> low_byte 192 >>> hi_byte = n >> 8 >>> hi_byte 48 # Add the extra bit back in that was masked off >>> hi_byte = hi_byte+128 >>> hi_byte 176 >>> -- Jerry _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor