You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a dynamic language interpreter that uses pointer tagging to identify records in memory. It uses staged tagging, so that the number of tag bits can vary depending on the type of record. These records are primarily defined as values of:
I highlight Cons, F64 and Atom because their tag sizes are 2 bits, 2 bits, and 4 bits respectively. All other tags use the full 6 bits of HeapCellValueTag. For the smaller tags, the remaining tag bits of HeapCellValue are used for other data. In particular, Atom-tagged cells are actually formatted like this:
My problem is that I can't extract the smaller tags from HeapCellValue values using the generated bitfield functions without adjacent bits of AtomCell being included in the resulting HeapCellValue's tag field upon conversion. Is it possible to access the bits of the bitfield without making assumptions about the endianness of the machine?
The text was updated successfully, but these errors were encountered:
mthom
changed the title
Varying field sizes in structs
Varying bitfield sizes in structs
Apr 15, 2021
mthom
changed the title
Varying bitfield sizes in structs
Variable bitfield sizes in structs
Apr 15, 2021
I'm writing a dynamic language interpreter that uses pointer tagging to identify records in memory. It uses staged tagging, so that the number of tag bits can vary depending on the type of record. These records are primarily defined as values of:
where tag is a bitfield specifier enum:
I highlight
Cons
,F64
andAtom
because their tag sizes are 2 bits, 2 bits, and 4 bits respectively. All other tags use the full 6 bits ofHeapCellValueTag
. For the smaller tags, the remaining tag bits ofHeapCellValue
are used for other data. In particular,Atom
-tagged cells are actually formatted like this:My problem is that I can't extract the smaller tags from
HeapCellValue
values using the generated bitfield functions without adjacent bits ofAtomCell
being included in the resultingHeapCellValue
'stag
field upon conversion. Is it possible to access the bits of the bitfield without making assumptions about the endianness of the machine?The text was updated successfully, but these errors were encountered: