Created
July 18, 2012 21:16
-
-
Save jussi-kalliokoski/3138956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function memcpy (src, srcOffset, dst, dstOffset, length) { | |
var i | |
src = src.subarray || src.slice ? src : src.buffer | |
dst = dst.subarray || dst.slice ? dst : dst.buffer | |
src = srcOffset ? src.subarray ? | |
src.subarray(srcOffset, length && srcOffset + length) : | |
src.slice(srcOffset, length && srcOffset + length) : src | |
if (dst.set) { | |
dst.set(src, dstOffset) | |
} else { | |
for (i=0; i<src.length; i++) { | |
dst[i + dstOffset] = src[i] | |
} | |
} | |
return dst | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment