aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 02935f8f..977ce004 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -717,7 +717,7 @@ var FAST_MEMORY = Module['FAST_MEMORY'] || {{{ FAST_MEMORY }}};
// Initialize the runtime's memory
#if USE_TYPED_ARRAYS
// check for full engine support (use string 'subarray' to avoid closure compiler confusion)
-assert(!!Int32Array && !!Float64Array && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']),
+assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']),
'Cannot fallback to non-typed array case: Code is too specialized');
#if USE_TYPED_ARRAYS == 1
@@ -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 }}}
@@ -993,8 +1004,9 @@ function removeRunDependency(id) {
runDependencyWatcher = null;
}
if (dependenciesFulfilled) {
- dependenciesFulfilled();
+ var callback = dependenciesFulfilled;
dependenciesFulfilled = null;
+ callback(); // can add another dependenciesFulfilled
}
}
}