aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/preamble.js b/src/preamble.js
index cb01994f..c66146ac 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -506,10 +506,17 @@ function allocate(slab, types, allocator, ptr) {
}
if (zeroinit) {
- _memset(ret, 0, size);
- return ret;
+ _memset(ret, 0, size);
+ return ret;
+ }
+
+#if USE_TYPED_ARRAYS == 2
+ if (singleType === 'i8') {
+ HEAPU8.set(new Uint8Array(slab), ret);
+ return ret;
}
-
+#endif
+
var i = 0, type;
while (i < size) {
var curr = slab[i];
@@ -750,17 +757,6 @@ function exitRuntime() {
CorrectionsMonitor.print();
}
-function String_len(ptr) {
- var i = ptr;
- while ({{{ makeGetValue('i++', '0', 'i8') }}}) { // Note: should be |!= 0|, technically. But this helps catch bugs with undefineds
-#if ASSERTIONS
- assert(i < TOTAL_MEMORY);
-#endif
- }
- return i - ptr - 1;
-}
-Module['String_len'] = String_len;
-
// Tools
// This processes a JS string into a C-line array of numbers, 0-terminated.