Skip to content

Commit

Permalink
extractBits() little optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
leodutra committed May 13, 2016
1 parent 87f96d1 commit 601a3cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/simpleflakes.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ function binary(value, padding) {
}

function extractBits(data, shift, length) {
return new BigNum(CACHE_64_BIT_ONES.substr(0, length), 2).shln(shift).and(new BigNum(data, 10)).shrn(shift);
//return new BigNum(CACHE_64_BIT_ONES.substr(0, length), 2).shln(shift).and(new BigNum(data, 10)).shrn(shift);
return (new BigNum(data, 10)).shrn(shift).and(new BigNum(CACHE_64_BIT_ONES.substr(0, length), 2));
}

function parseSimpleflake(flake) {
Expand Down

0 comments on commit 601a3cb

Please sign in to comment.