Skip to content

Instantly share code, notes, and snippets.

View JanBednarik's full-sized avatar

Jan Bednařík JanBednarik

View GitHub Profile
@JanBednarik
JanBednarik / Bits rotation
Last active March 30, 2016 14:52
Bits rotation
def rotate_left(byte):
"""
Rotate bits left.
"""
bit = byte & 0x80
byte <<= 1
if(bit):
byte |= 0x01
byte &= 0xFF
return byte