Module refinery.units.blockwise.rotl
Expand source code Browse git
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from refinery.units.blockwise import BinaryOperation
class rotl(BinaryOperation):
"""
Rotate the bits of each block left.
"""
def operate(self, value, shift):
shift %= self.fbits
return (value << shift) | (value >> (self.fbits - shift))
def inplace(self, value, shift):
shift %= self.fbits
lower = value >> (self.fbits - shift)
value <<= shift
value |= lower
Classes
class rotl (argument, bigendian=False, blocksize=None)
-
Rotate the bits of each block left.
Expand source code Browse git
class rotl(BinaryOperation): """ Rotate the bits of each block left. """ def operate(self, value, shift): shift %= self.fbits return (value << shift) | (value >> (self.fbits - shift)) def inplace(self, value, shift): shift %= self.fbits lower = value >> (self.fbits - shift) value <<= shift value |= lower
Ancestors
Class variables
var required_dependencies
var optional_dependencies
Methods
def operate(self, value, shift)
-
Expand source code Browse git
def operate(self, value, shift): shift %= self.fbits return (value << shift) | (value >> (self.fbits - shift))
def inplace(self, value, shift)
-
Expand source code Browse git
def inplace(self, value, shift): shift %= self.fbits lower = value >> (self.fbits - shift) value <<= shift value |= lower
Inherited members