-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ReadWrite/ReadOnly/WriteOnly should allow additional range types #28
Milestone
Comments
I have this mostly functional, but I'm trying to figure out if I can support |
Got it working with help from @ahoppen (thank you!) |
rauhul
added a commit
that referenced
this issue
Dec 6, 2023
Updates bit-field macros bits parameter to be generic over `BinaryInteger` `RangeExpression`s and adds an additional overload to enable the use of `UnboundedRange`. Example new uses: ```swift @register(bitWidth: 32) struct Example0 { @readwrite(bits: ...) var unbounded: Unbounded } @register(bitWidth: 32) struct Example1 { @readwrite(bits: ...16) var partialThrough: PartialThrough @readwrite(bits: 17...) var partialFrom: PartialFrom } @register(bitWidth: 32) struct Example2 { @readwrite(bits: ..<16) var partialUpTo: PartialUpTo @readwrite(bits: 16...31) var closed: Closed } ``` Fixes #28
rauhul
added a commit
that referenced
this issue
Dec 6, 2023
Updates bit-field macros bits parameter to be generic over `BinaryInteger` `RangeExpression`s and adds an additional overload to enable the use of `UnboundedRange`. Example new uses: ```swift @register(bitWidth: 32) struct Example0 { @readwrite(bits: ...) var unbounded: Unbounded } @register(bitWidth: 32) struct Example1 { @readwrite(bits: ...16) var partialThrough: PartialThrough @readwrite(bits: 17...) var partialFrom: PartialFrom } @register(bitWidth: 32) struct Example2 { @readwrite(bits: ..<16) var partialUpTo: PartialUpTo @readwrite(bits: 16...31) var closed: Closed } ``` Fixes #28
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
It would often be useful to express bit fields as closed ranges or other such range types:
@ReadWrite(22...22, as: Bool.self) var booleanLikeThing: BooleanLikeThing
or the remaining bits in a register layout:
@ReadOnly(16..., as: UInt16.self) var remainingBits: RemainingBits
The text was updated successfully, but these errors were encountered: