tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Extension to snprintb(3)

On Mon, 04 May 2009, Christos Zoulas wrote:
> >In particular, it's just about impossible to "remember" that you've
> >already processed the first field from
> >
> >     ctl = "\177\20b\0B0\0b\1B1\0F\2\1fld\0=\0ZERO\0=\1ONE\0b\4B4\0"
> >
> >since it is entirely acceptable for the 2-bit field to have a value of 
> >zero.
> Well, it is easy to do for the new format too. Instead of doing it in
> multiple calls, pass the maximum length in the call, and have snprintb
> insert newlines, or make it return an array of allocated buffers.

Or continue with the original plan of using multiple calls, but use a
mask to keep track of which bits still need to be handled.  The caller
would initialise the mask to ((uint64_t)-1), and loop until it is

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index