Notifications
Clear all
[Closed] bit.shift question
May 17, 2007 6:42 pm
Hi,
I need to import data from a binary file. (a 3D object with custom properties)
I have a question regarding the bit.shift mehod:
bit.shift val amount
if amount is a positive integer, then a left shift is performed
if amount is a negative integer, then a right shift is performed
so far, so good
but I need to do a ‘zero fill right shift’
I am at lost here, could anyone help me out please ?
Thanks in advance for any clues
2 Replies
May 17, 2007 6:42 pm
Here is a workaround mentioned:
http://mail.python.org/pipermail/python-list/2004-May/261013.html
Apparently, a >>> b is equal to the following:
if a >= 0: return a >> b
else: return (a>>b)+(2<<~b)
http://mail.python.org/pipermail/python-list/2004-May/261031.html
Georg