Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/forge/lib/forge/s3_signature.rb

Instance Method Summary collapse

Instance Method Details

#js_shl(count) ⇒ Object

32-bit left shift



207
208
209
210
# File 'lib/forge/lib/forge/s3_signature.rb', line 207

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 (>>>)



213
214
215
# File 'lib/forge/lib/forge/s3_signature.rb', line 213

def js_shr_zf(count)
  self >> count & (2**(32-count)-1)
end