Update index.js
A little optimization trick: hex.length will not change, so we can avoid to evaluate it each time we loop.
This commit is contained in:
parent
10305efe0c
commit
14a4fdf7fd
2
index.js
2
index.js
@ -214,7 +214,7 @@ var intToBytes = function(num) {
|
|||||||
*/
|
*/
|
||||||
var hexToBytes = function(hex) {
|
var hexToBytes = function(hex) {
|
||||||
var bytes = [];
|
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));
|
bytes.push(parseInt(hex.substr(c, 2), 16));
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user