From 14a4fdf7fd1d705e8e3f824f16ee6fecc5081eb7 Mon Sep 17 00:00:00 2001 From: Simon DENEL Date: Sat, 11 Apr 2015 15:42:28 +0200 Subject: [PATCH] Update index.js A little optimization trick: hex.length will not change, so we can avoid to evaluate it each time we loop. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index de0d91f..e40e2a6 100644 --- a/index.js +++ b/index.js @@ -214,7 +214,7 @@ var intToBytes = function(num) { */ var hexToBytes = function(hex) { var bytes = []; - for(var c = 0; c < hex.length; c += 2) { + for(var c = 0, C = hex.length; c < C; c += 2) { bytes.push(parseInt(hex.substr(c, 2), 16)); } return bytes;