class Integer

Public Instance Methods

js_shl(count) click to toggle source

32-bit left shift

# File lib/patch/integer.rb, line 3
def js_shl(count)
  v = (self << count) & 0xffffffff
  v > 2**31 ? v - 2**32 : v
end
js_shr_zf(count) click to toggle source

32-bit zero-fill right shift (>>>)

# File lib/patch/integer.rb, line 9
def js_shr_zf(count)
  self >> count & (2**(32-count)-1)
end