hilti
hilti copied to clipboard
Setting the %bitorder globally for the module has no effect
Setting the bitorder globally for the module apparently has no effect:
# cat mini.spicy
module Mini;
%bitorder=Spicy::BitOrder::MSB0;
export type Test = unit {
bits : bitfield(8) {
b0: 0;
middle: 1..6;
b7: 7;
};
on %done {
print self;
}
};
# printf "\x01" | spicy-driver mini.spicy
<bits=(b0=1, middle=0, b7=0)>
Expected output: <bits=(b0=0, middle=0, b7=1)>
.
Compare this with setting the bitorder for the field, which produces the desired result:
# cat mini-field.spicy
module Mini;
export type Test = unit {
bits : bitfield(8) {
b0: 0;
middle: 1..6;
b7: 7;
} &bitorder=Spicy::BitOrder::MSB0;
on %done {
print self;
}
};
# printf "\x01" | spicy-driver mini-field.spicy
<bits=(b0=0, middle=0, b7=1)>