Skip to content

Commit ef81de5

Browse files
committed
translate-c: initial support for bitfields
1 parent 12ef597 commit ef81de5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/bitfields-layout-reporter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ typedef struct {
3939
int main() {
4040
bitword w0 = {.a = -1};
4141
uint8_t backing0 = *(uint8_t *)(&w0);
42-
bool reserve = (backing0 & 0b10000000) > 0; // The bits allocates from MSB to LSB
42+
bool reverse = (backing0 & 0b10000000) > 0; // The bits allocates from MSB to LSB
4343

4444
bitword_unnamed w1 = {.c = -1, .a = -1};
4545
uint16_t backing1 = *(uint16_t *)(&w1);
46-
bool unnamed_void_boundary = (backing0 & (reserve ? 0b100000001000000 : 0b0000000100000001)) > 0;
46+
bool unnamed_void_boundary = (backing0 & (reverse ? 0b100000001000000 : 0b0000000100000001)) > 0;
4747

48-
printf(".{\n.target=\"%s\", .reverse_bits=%s,\n", ZIG_TARGET, reserve ? "true" : "false");
48+
printf(".{\n.target=\"%s\", .reverse_bits=%s,\n", ZIG_TARGET, reverse ? "true" : "false");
4949
printf(".unnamed_void_boundary=%s,\n", unnamed_void_boundary ? "true" : "false");
5050
printf("}\n");
5151
}

0 commit comments

Comments
 (0)