Skip to content

Commit 364f1f0

Browse files
committed
A much more reasonable approach to exponents
1 parent 4576e56 commit 364f1f0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/util/cborTypedArrayTags.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var UPPER32 = Math.pow(2, 32);
34
var warnedPrecision = false;
45
function warnPrecision() {
56
if (!warnedPrecision) {
@@ -18,7 +19,7 @@ function decodeUint64LE(data) {
1819
var si = i * 2;
1920
var lo = uint32View[si];
2021
var hi = uint32View[si+1];
21-
arr[i] = lo + Math.pow(2, 32) * hi;
22+
arr[i] = lo + UPPER32 * hi;
2223
}
2324

2425
return arr;
@@ -35,7 +36,7 @@ function decodeInt64LE(data) {
3536
var si = i * 2;
3637
var lo = uint32View[si];
3738
var hi = int32View[si+1];
38-
arr[i] = lo + Math.pow(2, 32) * hi;
39+
arr[i] = lo + UPPER32 * hi;
3940
}
4041

4142
return arr;

0 commit comments

Comments
 (0)