util: use regular loop constructs for u64 writes.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Christopher Jeffrey 2014-05-18 14:32:36 -05:00 committed by Fedor Indutny
parent 2aabef9a6d
commit 0b188640ec

View File

@ -188,6 +188,10 @@ utils.writeU64 = function writeU64(dst, num, off) {
dst[off++] = ch;
});
var i = num.length;
while (i--)
dst[off++] = num[i];
return 8;
};
@ -217,9 +221,8 @@ utils.writeU64BE = function writeU64BE(dst, num, off) {
while (num.length < 8)
num.unshift(0);
num.forEach(function(ch) {
dst[off++] = ch;
});
for (var i = 0; i < num.length; i++)
dst[off++] = num[i];
return 8;
};