def __cs_shift_to_arm_op(self, cs_op, cs_insn, arm_base):
        if cs_op.shift.type == 0:
            raise Exception("Invalid shift type.")

        cs_shift_mapper = {
            ARM_SFT_ASR : "asr",
            ARM_SFT_LSL : "lsl",
            ARM_SFT_LSR : "lsr",
            ARM_SFT_ROR : "ror",
            ARM_SFT_RRX : "rrx",
            ARM_SFT_ASR_REG : "asr",
            ARM_SFT_LSL_REG : "lsl",
            ARM_SFT_LSR_REG : "lsr",
            ARM_SFT_ROR_REG : "ror",
            ARM_SFT_RRX_REG : "rrx",
        }

        # The base register (arm_base) is not included in the shift
        # struct in Capstone, so it's provided separately.
        sh_type = cs_shift_mapper[cs_op.shift.type]

        if cs_op.shift.type <= ARM_SFT_RRX:
            amount = ArmImmediateOperand(cs_op.shift.value, self._arch_info.operand_size)

            # TODO: check if this is a valid case.
            if cs_op.shift.value == 0:
                raise Exception("Shift value is zero.")
        elif cs_op.shift.type <= ARM_SFT_RRX_REG:
            amount = self.__cs_reg_idx_to_arm_op_reg(cs_op.shift.value, cs_insn)
        else:
            raise Exception("Unknown shift type.")

        return ArmShiftedRegisterOperand(arm_base, sh_type, amount, arm_base.size)
dataset/ETHPy150Open programa-stic/barf-project/barf/barf/arch/arm/armdisassembler.py/ArmDisassembler.__cs_shift_to_arm_op/original