Skip to content
Discussion options

You must be logged in to vote

Hey! Thing I'd do would be some variation of this:

struct Primitive {
    u8 marker;

    // Handle end marker
    if (marker == 0xFF)
        break;

    padding[0x2F];
    PrimitiveType type;

    // Handle primitive types
    match (type) {
        (PrimitiveType::Line): Line data;
        (PrimitiveType::Bezier): Bezier data;
    }
};

Primitive primitives[while(true)] @ 0x00;

That matches all primitives until it hits the 0xFF marker

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by bos4711
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants