[Tutor] how to read one bit of a byte

shawn bright nephish at gmail.com
Wed Feb 21 22:34:43 CET 2007


Hey thanks for all the help guys, i am at least pulling some values
that make sense.
i feel more like i am on my way.

thanks again
shawn

On 2/21/07, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
> "Kent Johnson" <kent37 at tds.net> wrote
> > This is also a good application of bitwise operations.
> >
> > a & 128 will be 128 if the high bit in a is set, 0 if it is not.
>
> Only for an 8 bit integer! Most integers nowadays are
> 32 bit so you need to use 0x80000000 to get the msb!
>
> Alan G.
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list