aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js6
-rw-r--r--src/runtime.js10
2 files changed, 9 insertions, 7 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 3f7bd421..72166592 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -969,6 +969,12 @@ function generateStructTypes(type) {
}
ret[index++] = type;
} else {
+ if (Runtime.isStructType(type) && type[1] === '0') {
+ // this is [0 x something]. When inside another structure like here, it must be at the end,
+ // and it does nothing
+ assert(i === typeData.fields.length-1);
+ return;
+ }
add(Types.types[type]);
}
var more = (i+1 < typeData.fields.length ? typeData.flatIndexes[i+1] : typeData.flatSize) - (index - start);
diff --git a/src/runtime.js b/src/runtime.js
index 062066af..8c2c8f4d 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -214,7 +214,7 @@ var Runtime = {
// and it adds no size
assert(index === type.fields.length);
size = 0;
- alignSize = 0;
+ alignSize = type.alignSize || QUANTUM_SIZE;
} else {
size = Types.types[field].flatSize;
alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize);
@@ -228,12 +228,8 @@ var Runtime = {
}
if (type.packed) alignSize = 1;
type.alignSize = Math.max(type.alignSize, alignSize);
- if (size > 0) {
- var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory
- type.flatSize = curr + size;
- } else {
- curr = prev;
- }
+ var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory
+ type.flatSize = curr + size;
if (prev >= 0) {
diffs.push(curr-prev);
}