avoid truncating struct size

This commit is contained in:
Vaci Koblizek 2021-11-10 12:13:13 +00:00
parent 84dcb10085
commit 9bb1032274

View file

@ -1008,7 +1008,7 @@ final class WireHelpers {
} }
static SegmentBuilder setStructPointer(SegmentBuilder segment, CapTableBuilder capTable, int refOffset, StructReader value) { static SegmentBuilder setStructPointer(SegmentBuilder segment, CapTableBuilder capTable, int refOffset, StructReader value) {
short dataSize = (short)roundBitsUpToWords(value.dataSize); int dataSize = roundBitsUpToWords(value.dataSize);
int totalSize = dataSize + value.pointerCount * Constants.POINTER_SIZE_IN_WORDS; int totalSize = dataSize + value.pointerCount * Constants.POINTER_SIZE_IN_WORDS;
AllocateResult allocation = allocate(refOffset, segment, capTable, totalSize, WirePointer.STRUCT); AllocateResult allocation = allocate(refOffset, segment, capTable, totalSize, WirePointer.STRUCT);