-
Notifications
You must be signed in to change notification settings - Fork 156
Register access traits #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Daniel Egger <[email protected]>
Signed-off-by: Daniel Egger <[email protected]>
Signed-off-by: Daniel Egger <[email protected]>
Signed-off-by: Daniel Egger <[email protected]>
Signed-off-by: Daniel Egger <[email protected]>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ryankurte (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
src/util.rs
Outdated
9...16 => Ident::new("u16"), | ||
17...32 => Ident::new("u32"), | ||
33...64 => Ident::new("u64"), | ||
2..=8 => Ident::new("u8"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind moving out all those unrelated cleanups into a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done #307
mod_items.push(quote! { | ||
/// Wiggle in the specified value into the given bits with mask and the offset and return the new value | ||
#[inline] | ||
pub const fn set_bits(bits: #rty, mask: #rty, offset: u8, value: #rty) -> #rty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@therealprof I moved set_bits
here. I think it is the best trade-off: one const set_bits
per writable register as they can have different bit-size. Now only traits in vcell
b238406
to
edf23b3
Compare
I've done everything I could. |
I think it should be possible to have the traits defined in vcell directly in the generated code if you put them into a module. |
Where is the use of traits if each generated crate have own incompatible traits?
With |
Each
Sure but first you'll need to get your PR included there and I'm somewhat suspicious this is going to happen. 😏 For development it's a lot easier if everything is self-contained... I'm not too hot on having traits at all; I only care about real source code and compile time reduction, so macro tricks do not apply. |
Speaking of speed. How you tested it? Clean after each attempt? Can you repeat your tests with this variant? |
It does not have to be exactly |
No, I can't test this "as-is" due to the custom |
Thanks, I know. You probably missed the important bit here (emphasis mine):
|
Sorry. I'll try do something tomorrow. |
Try to test this branch: |
Move read/write/modify and set/clear bits into traits:
japaric/vcell#8