Ruud H.G. van Tol on Sun, 23 Jan 2022 04:41:42 +0100


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

Re: Addressable bits buffer, how?



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?

This "minimal overhead" already looks good:
? sizebyte("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890")
%919 = 112

-- Greetings, Ruud