← 输入框|github.com|刷新
Skip to content

Add support for bitwise left and right shift operators in UnsignedInteger class #2150

Closed

Description

@emoise-gsi

In lpython v18.1, the class UnsignedInteger, defined in lpython.py doesn't support bitwise shift operators. Please add something like:

    def __lshift__(self, other):
        if isinstance(other, self.__class__):
            return UnsignedInteger(self.bit_width, self.value << other.value)
        else:
            raise TypeError("Unsupported operand type")

    def __rshift__(self, other):
        if isinstance(other, self.__class__):
            return UnsignedInteger(self.bit_width, self.value >> other.value)
        else:
            raise TypeError("Unsupported operand type")

Activity

  1. emoise-gsi commented on Jul 11, 2023

    @emoise-gsi
    Author

    Not a blocker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions