dysfun@treehouse.systems ("gaytabase") wrote:
fun little problem i just came across: packing up to 64 34-bit integers for efficient random access. random constraint is that the datastructure is copy on write, so you have to copy the entire thing to make an edit.
there are two solutions that occur to me:
- use unaligned loads and shifts. kinda sucks to perform writes.
- have conceptually 4 sublists of 32 bit elements for each of the 4 possible 2-bit prefixes. lengths can be stored for each and it flattened into an array. a little faffy in managing the lists, but there seems some promise for being able to work on it with simd