On Wed, Nov 11, 2015 at 9:27 AM, kent nyberg wrote:
> Im reading about bitwise operators and is it true to say they dont work 100%
> as in C?
> bitwise operators in C seem to result in bits going to the so called
> bitbucket.
> For example, 0b0001. Shifting it >> 1 in C
On Wed, Nov 11, 2015 at 09:33:38AM +1100, Chris Angelico wrote:
> On Wed, Nov 11, 2015 at 9:27 AM, kent nyberg wrote:
>
> If you want to check specific bits (in C or Python, either way), it's
> much more common to use bitwise AND than bit shifts:
>
> >>> 0b100011011101010110
On Wed, Nov 11, 2015 at 9:56 AM, kent nyberg wrote:
> So, to check if 0b010[this one bit]010 is set, i do & 0b0001000
>
> That is, I set just that one to 1 in the other and then the & operator will
> make it return
> 0 if its not set. Since every other is zero, the return