This isn’t quite right: TypeSize
can be either in bits or in bytes. getTypeStoreSize()
returns a size in bytes, getTypeStoreSizeInBits()
returns a size in bits. These APIs usually come in pairs.
It’s not completely clear how your proposal handles this – is there going to be a TypeSize<Bits>
and TypeSize<Bytes>
?
I’m not really sure if this proposal is solving the right problem. Bits vs bytes is just a question of units, while the important semantic questions are in the distinction between type size, store size and alloc size. From the screnshot in your first post, the right way to avoid that / 8
might be to query the store size instead of the type size, or similar.