Skip to content

Remove Mask offset consts #315

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

Merged
merged 4 commits into from
Jul 18, 2019
Merged

Remove Mask offset consts #315

merged 4 commits into from
Jul 18, 2019

Conversation

burrbull
Copy link
Member

cc @therealprof

Example:

pub unsafe fn bits(self, value: u8) -> &'a mut W {
    self.w.bits &= !(0x1f << 8);
    self.w.bits |= ((value as u32) & 0x1f) << 8;
    self.w
}

pub fn dbl(&self) -> DBLR {
    let bits = ((self.bits >> 8) & 0x1f) as u8;
    DBLR { bits }
}

@burrbull burrbull requested a review from a team as a code owner July 18, 2019 13:19
@rust-highfive
Copy link

r? @ryankurte

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Jul 18, 2019
@therealprof
Copy link
Contributor

Hm, that makes me wonder for the reason why it was more complicated before...

@therealprof
Copy link
Contributor

bors try

bors bot added a commit that referenced this pull request Jul 18, 2019
@bors
Copy link
Contributor

bors bot commented Jul 18, 2019

try

Build succeeded

Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks.

@therealprof
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Jul 18, 2019
315: Remove Mask offset consts r=therealprof a=burrbull

cc @therealprof 

Example:
```rust
pub unsafe fn bits(self, value: u8) -> &'a mut W {
    self.w.bits &= !(0x1f << 8);
    self.w.bits |= ((value as u32) & 0x1f) << 8;
    self.w
}

pub fn dbl(&self) -> DBLR {
    let bits = ((self.bits >> 8) & 0x1f) as u8;
    DBLR { bits }
}
```

Co-authored-by: Andrey Zgarbul <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 18, 2019

Build succeeded

@bors bors bot merged commit 864327a into rust-embedded:master Jul 18, 2019
@burrbull burrbull deleted the maskoffset branch July 19, 2019 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants