File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ This changelog tracks the Rust `svdtools` project. See
7
7
8
8
* Add ` _expand_array `
9
9
* Allow register arrays in ` collect_in_cluster `
10
+ * Custom ` dimIncrement ` for 1-element ` cluster ` or ` array `
10
11
11
12
## [ v0.3.10] 2024-02-26
12
13
Original file line number Diff line number Diff line change @@ -1249,11 +1249,13 @@ fn collect_in_array(
1249
1249
let dim_increment = if dim > 1 {
1250
1250
offsets[ 1 ] - offsets[ 0 ]
1251
1251
} else {
1252
- registers[ 0 ]
1253
- . properties
1254
- . size
1255
- . map ( |s| s / 8 )
1256
- . unwrap_or_default ( )
1252
+ rmod. get_u32 ( "dimIncrement" ) ?. unwrap_or_else ( || {
1253
+ registers[ 0 ]
1254
+ . properties
1255
+ . size
1256
+ . map ( |s| s / 8 )
1257
+ . unwrap_or_default ( )
1258
+ } )
1257
1259
} ;
1258
1260
if !check_offsets ( & offsets, dim_increment) {
1259
1261
return Err ( anyhow ! (
@@ -1359,15 +1361,15 @@ fn collect_in_cluster(
1359
1361
let mut first = None ;
1360
1362
let mut dim = 0 ;
1361
1363
let mut dim_index = Vec :: new ( ) ;
1362
- let mut dim_increment = 0 ;
1364
+ let mut dim_increment = cmod . get_u32 ( "dimIncrement" ) ? . unwrap_or ( 0 ) ;
1363
1365
let mut offsets = Vec :: new ( ) ;
1364
1366
let mut place = usize:: MAX ;
1365
1367
let mut rspecs = Vec :: new ( ) ;
1366
1368
let single = !cname. contains ( "%s" ) ;
1367
1369
1368
1370
for ( rspec, rmod) in cmod {
1369
1371
let rspec = rspec. str ( ) ?;
1370
- if rspec == "description" {
1372
+ if rspec == "description" || rspec == "dimIncrement" {
1371
1373
continue ;
1372
1374
}
1373
1375
let mut registers = Vec :: new ( ) ;
You can’t perform that action at this time.
0 commit comments