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