Skip to content

Commit 566f7c7

Browse files
Tiwaluntherealprof
andauthored
Use integers instead of floats for size calculation
Co-Authored-By: Daniel Egger <[email protected]>
1 parent 6d45db6 commit 566f7c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/generate/peripheral.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl FieldRegions {
323323
let mut indices = Vec::new();
324324

325325
let field_start = field.offset;
326-
let field_end = field_start + (( field.size as f32 ) / (BITS_PER_BYTE as f32)).ceil() as u32;
326+
let field_end = field_start + (field.size + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
327327

328328
// The region that we're going to insert
329329
let mut new_region = Region {

0 commit comments

Comments
 (0)