From: Jesse Tane Date: Fri, 13 Feb 2015 21:39:23 +0000 (-0500) Subject: remove redundant code unit size check X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=3bce627d65e61f2ed2454da3c26e946846cb57d2;p=buffer.git remove redundant code unit size check --- diff --git a/index.js b/index.js index a2c9324..a526681 100644 --- a/index.js +++ b/index.js @@ -371,7 +371,7 @@ function base64Write (buf, string, offset, length) { } function utf16leWrite (buf, string, offset, length) { - var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length, 2) + var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) return charsWritten } @@ -1292,8 +1292,7 @@ function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } -function blitBuffer (src, dst, offset, length, unitSize) { - if (unitSize) length -= length % unitSize +function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; i++) { if ((i + offset >= dst.length) || (i >= src.length)) break