8000 Use precomputed constants. (Minor performance tweak) · arduino/cbor-js@587cf48 · GitHub
[go: up one dir, main page]

Skip to content

Commit 587cf48

Browse files
cynthiaparoga
authored andcommitted
Use precomputed constants. (Minor performance tweak)
1 parent d08b62a commit 587cf48

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cbor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
*/
2424

2525
(function(global, undefined) { "use strict";
26-
var POW_2_24 = Math.pow(2, -24),
27-
POW_2_32 = Math.pow(2, 32),
28-
POW_2_53 = Math.pow(2, 53);
26+
var POW_2_24 = 5.960464477539063e-8,
27+
POW_2_32 = 4294967296,
28+
POW_2_53 = 9007199254740992;
2929

3030
function encode(value) {
3131
var data = new ArrayBuffer(256);

0 commit comments

Comments
 (0)
0