implement @byteOffsetOf and @bitOffsetOf in userland #1574
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
At runtime you can do this to get offset:
We could make this work at compile time with the concept of lazy evaluated comptime values. For example even though we don't know the actual integer address of
&a
at comptime or of&a.a
, if the only thing the comptime code does with these values is subtract them, we can have that return the offset. That means we can delete@byteOffsetOf
and make it a userland function.As for
@bitOffsetOf
something similar could be done with taking the address of a bit packed field, plus@typeInfo
, since the bit offset information is in the pointer type.The text was updated successfully, but these errors were encountered: