Last active
December 23, 2015 15:39
-
-
Save glucero/6656843 to your computer and use it in GitHub Desktop.
where's the '>>>' operator, matz?!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShiftRightZeroFill | |
def >(operand) | |
(@value & 0xFFFFFFFF) >> operand | |
end | |
def initialize(value) | |
@value = value | |
end | |
end | |
class Fixnum | |
alias shift_right >> | |
def >>(operand = nil) | |
operand ? shift_right(operand) : ShiftRightZeroFill.new(self) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
... probably not worth it.