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 propose that we use an associated type to provide the bit width instead of a macro parameter. The associated type could be constrained to FixedWidthInteger & UnsignedInteger.
I think this would be more familiar to a Swift developer and it would also make the raw value type explicit.
I wonder if this could also allow the @RegisterBank macro to infer the offsets of the registers. (I haven’t developed a macro yet, so I don’t know the answer.)
The text was updated successfully, but these errors were encountered:
fumoboy007
changed the title
Use an associated type to provide the bit width of the register
Use an associated type to provide the bit width of a register
Jan 14, 2024
I wonder if this could also allow the @RegisterBank macro to infer the offsets of the registers. (I haven’t developed a macro yet, so I don’t know the answer.)
Not feasible. A macro can only read the code that it is attached to.
(I originally proposed this change here.)
Currently, the bit width of a register is specified as a parameter of the
@Register
macro:I propose that we use an associated type to provide the bit width instead of a macro parameter. The associated type could be constrained to
FixedWidthInteger & UnsignedInteger
.I think this would be more familiar to a Swift developer and it would also make the raw value type explicit.
I wonder if this could also allow the
@RegisterBank
macro to infer the offsets of the registers. (I haven’t developed a macro yet, so I don’t know the answer.)Before:
After:
The text was updated successfully, but these errors were encountered: