Skip to content

Instantly share code, notes, and snippets.

@auroranockert
Created November 25, 2011 15:36
Show Gist options
  • Save auroranockert/1393799 to your computer and use it in GitHub Desktop.
Save auroranockert/1393799 to your computer and use it in GitHub Desktop.
readBig: (bits) ->
a = (@data[@offset + 0] * Math.pow(2, 32)) +
(@data[@offset + 1] * Math.pow(2, 24)) +
(@data[@offset + 2] * Math.pow(2, 16)) +
(@data[@offset + 3] * Math.pow(2, 8)) +
(@data[@offset + 4] * Math.pow(2, 0))
a = (a % Math.pow(2, 40 - @pos))
a = (a / Math.pow(2, 40 - @pos - bits))
@advance(bits)
return a << 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment