Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98613 > unrolled thread

bitwise operator, bits dont go into bitbucket..?

Started bykent nyberg <kent@z-sverige.nu>
First post2015-11-10 17:27 -0500
Last post2015-11-10 17:27 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  bitwise operator, bits dont go into bitbucket..? kent nyberg <kent@z-sverige.nu> - 2015-11-10 17:27 -0500

#98613 — bitwise operator, bits dont go into bitbucket..?

Fromkent nyberg <kent@z-sverige.nu>
Date2015-11-10 17:27 -0500
Subjectbitwise operator, bits dont go into bitbucket..?
Message-ID<mailman.219.1447194444.16136.python-list@python.org>
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?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web