Skip to content

Commit

Permalink
Dreamt of integer division in js
Browse files Browse the repository at this point in the history
  • Loading branch information
larabr committed Mar 12, 2021
1 parent 142fbbf commit 1c86ce4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const util = {
if (bitSize === 0) {
throw new Error('Zero MPI');
}
const stripped = bin.subarray(bin.length - ((bitSize + 7) / 8));
const stripped = bin.subarray(bin.length - Math.ceil(bitSize / 8));
const prefix = Uint8Array.from([(bitSize & 0xFF00) >> 8, bitSize & 0xFF]);
return util.concatUint8Array([prefix, stripped]);
},
Expand Down

0 comments on commit 1c86ce4

Please sign in to comment.