Skip to content

Instantly share code, notes, and snippets.

@rom1504
Last active June 25, 2016 01:11
Show Gist options
  • Save rom1504/967218116b3289906b288e5859c8e0de to your computer and use it in GitHub Desktop.
Save rom1504/967218116b3289906b288e5859c8e0de to your computer and use it in GitHub Desktop.
position in chunk 1.9
const cursorInBits=getArrayPosition(pos)*this.bitsPerBlock;
const firstLongPosition=Math.floor(cursorInBits/64);
const shouldBePosition=(64-this.bitsPerBlock)-cursorInBits%64;
const positionInFirstLong=Math.max(shouldBePosition,0);
if(shouldBePosition<0)
{
const lastLongPosition=firstLongPosition+1;
const positionInLastLong=64+shouldBePosition;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment