Skip to content

Commit

Permalink
A much more reasonable approach to exponents
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollrath committed Nov 5, 2018
1 parent 4576e56 commit 364f1f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util/cborTypedArrayTags.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

var UPPER32 = Math.pow(2, 32);
var warnedPrecision = false;
function warnPrecision() {
if (!warnedPrecision) {
Expand All @@ -18,7 +19,7 @@ function decodeUint64LE(data) {
var si = i * 2;
var lo = uint32View[si];
var hi = uint32View[si+1];
arr[i] = lo + Math.pow(2, 32) * hi;
arr[i] = lo + UPPER32 * hi;
}

return arr;
Expand All @@ -35,7 +36,7 @@ function decodeInt64LE(data) {
var si = i * 2;
var lo = uint32View[si];
var hi = int32View[si+1];
arr[i] = lo + Math.pow(2, 32) * hi;
arr[i] = lo + UPPER32 * hi;
}

return arr;
Expand Down

0 comments on commit 364f1f0

Please sign in to comment.