Yet Another Bug Fix
This commit is contained in:
parent
0c41b1593b
commit
cd82bb2c41
@ -58,7 +58,7 @@ export class SimpleProperty implements Property {
|
||||
} else {
|
||||
// Structure
|
||||
const structure = getStructure(this.#type);
|
||||
return structure.getSize();
|
||||
return structure.getSize(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class Struct {
|
||||
const alignment = this.getAlignment();
|
||||
return Math.ceil(size / alignment) * alignment;
|
||||
}
|
||||
getSize() {
|
||||
getSize(round: boolean) {
|
||||
let size;
|
||||
if (this.#size !== null) {
|
||||
size = this.#size;
|
||||
@ -61,7 +61,9 @@ export class Struct {
|
||||
}
|
||||
}
|
||||
}
|
||||
size = this.#roundSize(size);
|
||||
if (round) {
|
||||
size = this.#roundSize(size);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
getName() {
|
||||
@ -120,7 +122,7 @@ export class Struct {
|
||||
this.#properties.sort((a, b) => a.propertyOffset() - b.propertyOffset());
|
||||
|
||||
// Check Size
|
||||
const size = this.getSize();
|
||||
const size = this.getSize(true);
|
||||
if (this.#size !== null) {
|
||||
// Check Alignment
|
||||
if (size !== this.#size) {
|
||||
@ -188,7 +190,7 @@ export class Struct {
|
||||
} else if (i === this.#properties.length) {
|
||||
// End Of Structure Padding
|
||||
if (this.#size !== null && lastProperty) {
|
||||
const realSize = lastProperty.propertyOffset() + lastProperty.propertySize();
|
||||
const realSize = this.#roundSize(lastProperty.propertyOffset() + lastProperty.propertySize());
|
||||
neededPadding = this.#size - realSize;
|
||||
}
|
||||
} else {
|
||||
@ -229,7 +231,7 @@ export class Struct {
|
||||
}
|
||||
|
||||
// Sanity Check Size
|
||||
const size = this.getSize();
|
||||
const size = this.getSize(true);
|
||||
const isSizeDefined = this.#size !== null;
|
||||
out += assertSize(this.#name, size, isSizeDefined);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user