Fix bool defaults for non-first bit
Fixes: #58 Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
b2b7ade9c0
commit
eb1839e001
1 changed files with 1 additions and 1 deletions
|
|
@ -672,7 +672,7 @@ static void get_member(struct str *func, struct field *f, const char *ptr, const
|
|||
switch (f->v.t.which) {
|
||||
case Type__bool:
|
||||
str_addf(func, "%s = (capn_read8(%s, %d) & %d) != %d;\n",
|
||||
var, ptr, f->f.slot.offset/8, 1 << (f->f.slot.offset%8), (int)f->v.intval);
|
||||
var, ptr, f->f.slot.offset/8, 1 << (f->f.slot.offset%8), ((int)f->v.intval) << (f->f.slot.offset%8));
|
||||
return;
|
||||
case Type_int8:
|
||||
str_addf(func, "%s = (int8_t) ((int8_t)capn_read8(%s, %d))%s;\n", var, ptr, f->f.slot.offset, xor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue