aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-21 18:08:18 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-09-23 14:33:24 -0700
commit79b2ee72ba44f674a0c1f3546d2bf1576af7e9b0 (patch)
treeb430d59ebb1e9b7b35a5c7c9183992462e462731 /src/preamble.js
parentb1f12d5192a10800c4694d22ef0fcc62d4b7d2b4 (diff)
relooper input is ascii, emit it to the heap more efficiently with writeAsciiToMemory1.6.1
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 8e70cb74..acff665f 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -908,6 +908,17 @@ function writeArrayToMemory(array, buffer) {
}
Module['writeArrayToMemory'] = writeArrayToMemory;
+function writeAsciiToMemory(str, buffer, dontAddNull) {
+ for (var i = 0; i < str.length; i++) {
+#if ASSERTIONS
+ assert(str.charCodeAt(i) === str.charCodeAt(i)&0xff);
+#endif
+ {{{ makeSetValue('buffer', 'i', 'str.charCodeAt(i)', 'i8') }}}
+ }
+ if (!dontAddNull) {{{ makeSetValue('buffer', 'str.length', 0, 'i8') }}}
+}
+Module['writeAsciiToMemory'] = writeAsciiToMemory;
+
{{{ unSign }}}
{{{ reSign }}}