aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorJoel Croteau <jcroteau@gmail.com>2014-02-19 04:19:43 -0800
committerJoel Croteau <jcroteau@gmail.com>2014-02-19 04:21:33 -0800
commita28fad120298fee2b120c47aa0b6d29bf3ff0830 (patch)
tree368281faa461a4bab2d1c8e3aaf817220b35fdeb /src/preamble.js
parentc84c6eda17a6ac5e9c56bbc76839c472238a97c4 (diff)
Correct syntax of allocate function
Fix mistaken syntax for use of allocate and restore original, very strange syntax.
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 0be5b4de..1c9de066 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -529,18 +529,17 @@ function allocate(slab, types, allocator, ptr) {
}
#endif
- var index = 0, byteIndex = 0, type, typeSize, previousType;
- while ((singleType ? index : byteIndex) < size) {
- var curr = slab[index];
+ var i = 0, type, typeSize, previousType;
+ while (i < size) {
+ var curr = slab[i];
if (typeof curr === 'function') {
curr = Runtime.getFunctionIndex(curr);
}
- type = singleType || types[byteIndex];
+ type = singleType || types[i];
if (type === 0) {
- index++;
- byteIndex++;
+ i++;
continue;
}
#if ASSERTIONS
@@ -551,15 +550,14 @@ function allocate(slab, types, allocator, ptr) {
if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later
#endif
- setValue(ret+byteIndex, curr, type);
+ setValue(ret+i, curr, type);
// no need to look up size unless type changes, so cache it
if (previousType !== type) {
typeSize = Runtime.getNativeTypeSize(type);
previousType = type;
}
- index++;
- byteIndex += typeSize;
+ i += typeSize;
}
return ret;