Skip to content

Commit ac3a074

Browse files
author
Izzy Lancaster
committed
Fixed signed offset bug in pattern file @octylFractal pointed out
1 parent c7b94c0 commit ac3a074

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

capnproto.hexpat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ bitfield Bit { b: 1; };
1111
namespace SpecialWords {
1212
bitfield StructPointer {
1313
A: 2 [[comment("Always 0")]];
14-
Offset: 30 [[comment("Offset in words from the end of the pointer to the start of the struct's data section. Signed")]];
14+
signed Offset: 30 [[comment("Offset in words from the end of the pointer to the start of the struct's data section. Signed")]];
1515
DataSectionSize: 16 [[comment("Size of the struct's data section in words.")]];
1616
PointerSectionSize: 16 [[comment("Size of the struct's data section in words.")]];
1717
} [[color("FF964F"), format("SpecialWords::format_struct_pointer")]];
1818

1919
bitfield ListPointer {
2020
A: 2; // Always 1
21-
Offset: 30;
21+
signed Offset: 30;
2222
ElementSize: 3;
2323
ListSize: 29;
2424
} [[color("A7C7E7"), format("SpecialWords::format_list_pointer")]];
@@ -130,8 +130,8 @@ struct StructContent<auto DataSize, auto PointerSize> {
130130

131131
struct StructPointer {
132132
SpecialWords::StructPointer ptrWord;
133-
bool isNull = (ptrWord.Offset + ptrWord.DataSectionSize + ptrWord.PointerSectionSize) == 0;
134-
bool isEmpty = (ptrWord.Offset == -1) && ((ptrWord.DataSectionSize + ptrWord.PointerSectionSize) == 0);
133+
bool isNull = (ptrWord.Offset | ptrWord.DataSectionSize | ptrWord.PointerSectionSize) == 0;
134+
bool isEmpty = (ptrWord.Offset == -1) && ((ptrWord.DataSectionSize | ptrWord.PointerSectionSize) == 0);
135135

136136
if (!isNull && !isEmpty)
137137
StructContent<ptrWord.DataSectionSize, ptrWord.PointerSectionSize> content @ calc_offset(ptrWord) [[inline]];

0 commit comments

Comments
 (0)