Skip to content
Discussion options

You must be logged in to vote

The bitfields make this somewhat tricky but here is a Codon representation that should be compatible with that C struct:

@tuple
class Symbol:
    symbol: cobj
    symbold_id: i32
    RESERVED_00_0: u8
    RESERVED_00_1: u8
    RESERVED_00_2: u8
    char_ref0: u8
    char_ref1: u8
    char_ref2: u8
    char_ref3: u8
    char_ref4: u8
    char_ref5: u8
    char_ref6: u8
    char_ref7: u8
    _padding: u8
    _bitfields1: UInt[96]
    _bitfields2: u32

    @property
    def tick_size(self):
        return int(self._bitfields1) & 0xffff

    @property
    def v1(self):
        return bool(self._bitfields1 & (UInt[96](1) << UInt[64]))

    @property
    def v2(self):
        return bool(self._…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by qinwf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants