Advertisement
SplittyDev

Untitled

Jan 1st, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.43 KB | None | 0 0
  1. struct Int
  2.   def <<(count)
  3.     unsafe_shl count
  4.   end
  5.  
  6.   def >>(count)
  7.     unsafe_shr count
  8.   end
  9.  
  10.   def ===(other : Int)
  11.     self == other
  12.   end
  13.  
  14.   def /(other : Int)
  15.     if other == 0
  16.       self
  17.     end
  18.     unsafe_div other
  19.   end
  20.  
  21.   def %(other : Int)
  22.     if other == 0
  23.       self
  24.     end
  25.     unsafe_mod other
  26.   end
  27.  
  28.   def times
  29.     i = 0
  30.     while i < self
  31.       yield i
  32.       i += 1
  33.     end
  34.   end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement