Skip to content

Commit 4c127dc

Browse files
author
Jorge Aparicio
committed
fix masks
1 parent cbc4f18 commit 4c127dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ pub fn gen_register(r: &Register,
688688
field.name
689689
.to_snake_case()));
690690
let width = field.bit_range.width;
691-
let mask = Lit::Int((1u64 << width - 1), IntTy::Unsuffixed);
691+
let mask = Lit::Int((1u64 << width) - 1, IntTy::Unsuffixed);
692692
let offset = Lit::Int(u64::from(field.bit_range.offset),
693693
IntTy::Unsuffixed);
694694
let field_ty = width.to_ty();
@@ -908,7 +908,7 @@ pub fn gen_register(r: &Register,
908908
let field_name_sc = Ident::new(&*field.name
909909
.to_sanitized_snake_case());
910910
let width = field.bit_range.width;
911-
let mask = Lit::Int((1u64 << width - 1), IntTy::Unsuffixed);
911+
let mask = Lit::Int((1u64 << width) - 1, IntTy::Unsuffixed);
912912
let offset = Lit::Int(u64::from(field.bit_range.offset),
913913
IntTy::Unsuffixed);
914914
let field_ty = width.to_ty();

0 commit comments

Comments
 (0)