From 94f7f0291840f00c46a2a0e01bc3c2ccd00350b2 Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Tue, 14 Dec 2021 17:16:43 +0900 Subject: [PATCH 1/2] perf: removing unnecessary double substraction --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 3cf497d..066977f 100644 --- a/index.js +++ b/index.js @@ -46,8 +46,8 @@ module.exports = function base32Decode (input, variant) { bits += 5 if (bits >= 8) { - output[index++] = (value >>> (bits - 8)) & 255 bits -= 8 + output[index++] = (value >>> bits) & 255 } } From a4630f22c2b9004f68612669572910d0eba53f0f Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Tue, 14 Dec 2021 18:49:34 +0900 Subject: [PATCH 2/2] perf: delegating bitmask to Uint8Array implementation --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 066977f..4aaf49f 100644 --- a/index.js +++ b/index.js @@ -47,7 +47,7 @@ module.exports = function base32Decode (input, variant) { if (bits >= 8) { bits -= 8 - output[index++] = (value >>> bits) & 255 + output[index++] = value >>> bits } }