Skip to content

Commit abbd6b1

Browse files
committed
Auto merge of #82 - whitequark:one-bit-too-much, r=japaric
Fix a possible shift past integer width This happens for a write constraint specifying the range 0..2^32-1.
2 parents b22a910 + 7d0602b commit abbd6b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ pub fn fields(
948948
if let Some(write_constraint) = f.write_constraint {
949949
match *write_constraint {
950950
WriteConstraint::Range(ref range) => {
951-
if range.min == 0 && range.max == (1 << f.width) - 1 {
951+
if range.min as u64 == 0 && range.max as u64 == (1u64 << f.width) - 1 {
952952
// the SVD has acknowledged that it's safe to write
953953
// any value that can fit in the bitfield
954954
safety = None;

0 commit comments

Comments
 (0)