Frage im Vorstellungsgespräch bei Oracle

Bit Rotation function.

Antwort im Vorstellungsgespräch

Anonym

17. Apr. 2017

Rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put back to the other end. # Max number of bits BITS = 8 def left_rotate(number, bits): """ Function to left rotate a number by the given bit count. """ return int('1'*BITS, 2) & ((number > (BITS - bits)))