isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Circular Bitshift (right) and other possible bit manipulation functions #238

Closed DonaldTsang closed 6 years ago

DonaldTsang commented 6 years ago
def circular(num, bits, shift):
    return ( num >> shift ) + ( ( num & ( 2 ** shift - 1 ) ) << ( bits - shift ) )
def circular_left(num, bits, shift):
    return circular(num, bits, bits - shift)
isaacg1 commented 6 years ago

This seems really unlikely to be relevant.