Bitstream matcher

As part of a CCITT decoder for the PDF crate, I wrote some codegen that takes basically a match of bit prefixes to expressions and turns them into lookup tables.

Does anyone else need something like that?

bitmaps! {
    mode <Mode> {
        0001 => Pass,
        001 => Horizontal,
        1 => Vertical(0),
        011 => Vertical(1),
        000011 => Vertical(2),
        0000011 => Vertical(3),
        010 => Vertical(-1),
        000010 => Vertical(-2),
        0000010 => Vertical(-3),
    }
}

code: https://github.com/s3bk/fax

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.