Re:A Bit Overcomplicated
by voidnullnil on Friday August 06, 2021 @12:11PM
(#28089148)
Yaeh, my point was that it is trivial to define a pad function and call it instead of needing some syntax like Erlang. But now I see there is deconstruction too, which is more arguably useful to take the time to add syntax for.
> say sendSeq was one bit but we still wanted it to take 3 bits:
> [0] ++ pad 3 sendSeq ++ poll ++ recvSeq
In Erlang you could do this to get something padded (or truncated) to the correct size:
So you can do something like this to ensure the precise bit size of each field: