Yes, that would be sufficient for most (but not all) use cases. However, I wonder how much difference it would make. Unless the bit mask has only one byte, alignment rules prevent memory savings for smaller length types (without packed structs, that is).
Introducing an additional parameter for the length type would make PackedVector{U,M,T} an abstract type, which is somewhat inconvenient. More importantly, I’m thinking of storing the length inside the bit mask and not as a separate field. That would solve the alignment issue.
get rid of your type parameter
M
I agree. The current first step is to make the existing API work with EmulatedBitIntegers.jl. If the parameter M is removed, then one has no choice but to use EmulatedInteger types. There are still some open issues with them. I’d like to wait until they are sorted out before I make that switch.