Method: S3SwfUpload::Signature#safe_add
- Defined in:
- lib/s3_swf_upload/signature.rb
#safe_add(x, y) ⇒ Object
Add integers, wrapping at 2^32. This uses 16-bit operations internally to work around bugs in some JS interpreters.
126 127 128 129 |
# File 'lib/s3_swf_upload/signature.rb', line 126 def safe_add(x, y) v = (x+y) % (2**32) return v > 2**31 ? v- 2**32 : v end |