Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/d2s3/patch/integer.rb
Instance Method Summary collapse
-
#js_shl(count) ⇒ Object
32-bit left shift.
-
#js_shr_zf(count) ⇒ Object
32-bit zero-fill right shift (>>>).
Instance Method Details
#js_shl(count) ⇒ Object
32-bit left shift
3 4 5 6 |
# File 'lib/d2s3/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) ⇒ Object
32-bit zero-fill right shift (>>>)
9 10 11 |
# File 'lib/d2s3/patch/integer.rb', line 9 def js_shr_zf(count) self >> count & (2**(32-count)-1) end |