def __mul__(self, scale): from peachpy.x86_64.operand import MemoryAddress from peachpy.util import is_int if not is_int(scale): raise TypeError("Register can be scaled only by an integer number") if int(scale) not in {1, 2, 4, 8}: raise ValueError("Invalid scale value (%d): only scaling by 1, 2, 4, or 8 is supported" % scale) return MemoryAddress(index=self, scale=scale)
def __sub__(self, offset): from peachpy.x86_64.operand import MemoryAddress return MemoryAddress(self) - offset