Bill Allombert on Sun, 23 Jan 2022 08:32:32 +0100


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

Re: Addressable bits buffer, how?


On Sun, Jan 23, 2022 at 04:41:37AM +0100, Ruud H.G. van Tol wrote:
> 
> On 2022-01-22 14:08, Bill Allombert wrote:
> > On Sat, Jan 22, 2022 at 01:37:53PM +0100, Ruud H.G. van Tol wrote:
> > > What are the ways to do raw bit buffer efficiently?
> > 
> > in GP, It is not quite possible, since there is no 'in place' operation,
> > but you can try to use Vecsmall() and vectorsmall()
> > 
> > In C you can use the function class F2v_ (F2v_coeff, F2v_set, F2_clear,
> > etc) for bits, and t_VECSMALL for word-size.
> 
> I was thinking about using a t_STR, but strchr(0) errors.
> 
> I am assuming there is a good reason for that,
> so now I think a t_BYTE would be welcome,
> maybe with a related t_VECTINY (0..255, maybe also -128..127?).
> Would that be worth it to dig into?

It is not needed, you can use t_VECSMALL instead.
You just need to pack them, as it is done for bits with F2v.

Cheers,
Bill.