File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,14 +26,17 @@ impl ClocksTable for Table {
2626 writer : & mut W ,
2727 _previous_table : & ClocksTableGen ,
2828 ) -> Result < ( ) > {
29- for ( i, level) in self . sclk_levels . iter ( ) . enumerate ( ) {
30- let command = level_command ( * level, i, 's' ) ;
31- writer. write_all ( command. as_bytes ( ) ) ?;
32- }
29+ let max_len = cmp:: max ( self . sclk_levels . len ( ) , self . mclk_levels . len ( ) ) ;
30+ for i in 0 ..max_len {
31+ if let Some ( sclk_level) = self . sclk_levels . get ( i) {
32+ let command = level_command ( * sclk_level, i, 's' ) ;
33+ writer. write_all ( command. as_bytes ( ) ) ?;
34+ }
3335
34- for ( i, level) in self . mclk_levels . iter ( ) . enumerate ( ) {
35- let command = level_command ( * level, i, 'm' ) ;
36- writer. write_all ( command. as_bytes ( ) ) ?;
36+ if let Some ( mclk_level) = self . mclk_levels . get ( i) {
37+ let command = level_command ( * mclk_level, i, 'm' ) ;
38+ writer. write_all ( command. as_bytes ( ) ) ?;
39+ }
3740 }
3841
3942 Ok ( ( ) )
@@ -336,16 +339,16 @@ mod tests {
336339
337340 let expected_commands = arr_commands ( [
338341 "s 0 350 800" ,
342+ "m 0 360 750" ,
339343 "s 1 600 800" ,
344+ "m 1 1000 825" ,
340345 "s 2 900 912" ,
346+ "m 2 2250 975" ,
341347 "s 3 1145 1125" ,
342348 "s 4 1215 1150" ,
343349 "s 5 1257 1150" ,
344350 "s 6 1300 1150" ,
345351 "s 7 1500 1200" ,
346- "m 0 360 750" ,
347- "m 1 1000 825" ,
348- "m 2 2250 975" ,
349352 ] ) ;
350353
351354 assert_eq ! ( expected_commands, commands) ;
You can’t perform that action at this time.
0 commit comments