aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-12 17:42:15 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-03-12 17:42:15 -0700
commitdb4b94a83eee7044d539f077536170f60d0eee6a (patch)
tree1fed6a9df5613d28ea3e90545375a29ea9975cb0 /src
parent9483f8b998df9c49a4122d163e0e2ef92bf7a1c1 (diff)
optimize pread to use typed array set()
Diffstat (limited to 'src')
-rw-r--r--src/library.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index 0f8b0af5..8bce7a14 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1730,7 +1730,12 @@ LibraryManager.library = {
}
var contents = stream.object.contents;
var size = Math.min(contents.length - offset, nbyte);
- if (contents.subarray || contents.slice) { // typed array or normal array
+#if USE_TYPED_ARRAYS == 2
+ if (contents.subarray) { // typed array
+ HEAPU8.set(contents.subarray(offset, offset+size), buf);
+ } else
+#endif
+ if (contents.slice) { // normal array
for (var i = 0; i < size; i++) {
{{{ makeSetValue('buf', 'i', 'contents[offset + i]', 'i8') }}}
}