Skip to content

Instantly share code, notes, and snippets.

@glucero
Last active December 23, 2015 15:39
Show Gist options
  • Save glucero/6656843 to your computer and use it in GitHub Desktop.
Save glucero/6656843 to your computer and use it in GitHub Desktop.
where's the '>>>' operator, matz?!
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
@glucero
Copy link
Author

glucero commented Sep 22, 2013

    (main) > -1149025787.>>> 0
    => 31459415090

... probably not worth it.

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