AaronKutch / awint

Arbitrary width integers
Other
10 stars 0 forks source link

use the thin-vec strategy #18

Closed AaronKutch closed 1 year ago

AaronKutch commented 1 year ago

I initially designed ExtAwi, InlAwi, and Bits back before certain pointer related things were const, and after seeing https://crates.io/crates/thin-vec I realized that maybe I can in fact eliminate LEN or at least the unnecessary extra usize from all the types without needing custom DST support. I may even want to pursue storing bitwidth externally with bit storage like thin-vec since a lot more of these types tend to be used at the same time in a function vs the typical cases for Vec. This time around, we have the bitwidth as a header instead of a janky trailer, which should cancel out some extra ops incurred.

AaronKutch commented 1 year ago

In 0.12 I finally figured out a workaround. The bitwidth is stored inline without the raw length (InlAwi still has LEN but only for the size of the array), and no more raw metadata digits are needed.