[foreign-memaccess] layouts, bits and bytes: call for bikeshed :-)
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri May 15 14:16:05 UTC 2020
Hi,
currently the MemoryLayout API is defined internally in terms of bits;
this is for a reason, as we want to be able to use layouts for sub-bytes
entities (e.g. bitfields). That said, the API is quite liberal in
allowing the user to interact with it either in bits or bytes. For
instance both layout size and alignment can be retrieved in the
preferred format.
There's an exception to this rule: layout creation. We have two
factories, namely:
MemoryLayout::ofValueBits
MemoryLayout::ofPaddingBits
Which do not provide the corresponding XYZByte overloads.
If we were to add such overloads, the next hurdle would be the set of
constants in MemoryLayouts, where we have e.g.
ValueLayout BITS_8_LE
ValueLayout BITS_16_LE
...
Perhaps it would make sense to expose these in bytes too as well as
bits, and add:
ValueLayout BYTES_1_LE
ValueLayout BYTES_2_LE
...
How do people feel about these changes? Useful? Confusing?
Let's paint this bikeshed :-)
Cheers
Maurizio
More information about the panama-dev
mailing list