bitwise operator, bits dont go into bitbucket..?
kent nyberg
kent at z-sverige.nu
Tue Nov 10 17:27:21 EST 2015
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, 0b00000001. Shifting it >> 1 in C it seems to add on zero to the left and the 1 to the right gets throwned away.
But doing it in python just adds one more bit, from the left.
That is, 0b00000001 >> 1 = 0b000000001.
Bitwise operators in C (when reading examples,) gives some time code that check specific bits by
shifting the bits left and right to make every bit but the specific one to zeros.
As I understand bitwise operators in python, this is not possible then?
More information about the Python-list
mailing list