8 ms·
I have an (in-progress, but usable) project for generating rust code for parsing and generating these kinds of protocols: https://github.com/mwylde/protogen/tre
by necubi 6y ago
I have an (in-progress, but usable) project for generating rust code for parsing and generating these kinds of protocols: https://github.com/mwylde/protogen/tree/to_vec https://github.com/mwylde/protogen/tree/to_vec. It supports integers of arbitrary bit sizes up to 64.
- boulos 6y agoCool! I was curious to see what you chose to do for representing arbitrary bit width. I didn't see an example / test for something like u19 though. Your backend compilation seems to generate calls to an arbitrary width [1], but I only see explicit 8/16/32/64s generated or tested [2]. The code definitely seems ready for size != width, and answering some of my question "sizes less than 8 round up to u8, otherwise round up to nearest power of 2" [3]. Either way, it looks like a great start! Your little language seems like it probably has enough in it already for my VP8 example. [1] https://github.com/mwylde/protogen/blob/f812dd74e5cebe680422ae2382e97eb487e78c68/protogen-compiler/src/backend.rs#L325 https://github.com/mwylde/protogen/blob/f812dd74e5cebe680422... [2] https://github.com/mwylde/protogen/blob/f812dd74e5cebe680422ae2382e97eb487e78c68/protogen/src/lib.rs#L340 https://github.com/mwylde/protogen/blob/f812dd74e5cebe680422... [3] https://github.com/mwylde/protogen/blob/f812dd74e5cebe680422ae2382e97eb487e78c68/protogen-compiler/src/backend.rs#L241 https://github.com/mwylde/protogen/blob/f812dd74e5cebe680422...