Use with OnStack idiom for temporary char buffers
Use with OnStack idiom for temporary char buffers
Given a string and charset, compute how many bits it contains.
Given a string and charset, compute how many bits it contains.
This only has to scan the string if the charset is a variable-width encoding. Otherwise this is just constant time.
Truncates the string to what will fit.
Truncates the string to what will fit.
This leaves a potential fragment space. This space might be a few bits (non byte-sized space), or more than one byte if say the string is utf-8, the last character needs 3 bytes, but only 2 bytes + a few more bits are available.
That unused space is supposed to get filled by the RightFillUnparser with fillbyte