File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ utils = { path = "../utils" }
1212
1313[features ]
1414unsafe = [" utils/unsafe" ]
15+ const_lut = []
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ enum DirectionalKeypad {
2323 Left = 1 , Down = 2 , Right = 3 ,
2424}
2525
26+ #[ cfg( feature = "const_lut" ) ]
2627static PART1_MATRIX : [ [ u64 ; 11 ] ; 11 ] = num_matrix ( 2 ) ;
28+ #[ cfg( feature = "const_lut" ) ]
2729static PART2_MATRIX : [ [ u64 ; 11 ] ; 11 ] = num_matrix ( 25 ) ;
2830
2931impl Day21 {
@@ -37,12 +39,20 @@ impl Day21 {
3739
3840 #[ must_use]
3941 pub fn part1 ( & self ) -> u64 {
40- self . complexity ( & PART1_MATRIX )
42+ #[ cfg( feature = "const_lut" ) ]
43+ return self . complexity ( & PART1_MATRIX ) ;
44+
45+ #[ cfg( not( feature = "const_lut" ) ) ]
46+ return self . complexity ( & num_matrix ( 2 ) ) ;
4147 }
4248
4349 #[ must_use]
4450 pub fn part2 ( & self ) -> u64 {
45- self . complexity ( & PART2_MATRIX )
51+ #[ cfg( feature = "const_lut" ) ]
52+ return self . complexity ( & PART2_MATRIX ) ;
53+
54+ #[ cfg( not( feature = "const_lut" ) ) ]
55+ return self . complexity ( & num_matrix ( 25 ) ) ;
4656 }
4757
4858 fn complexity ( & self , matrix : & [ [ u64 ; 11 ] ; 11 ] ) -> u64 {
You can’t perform that action at this time.
0 commit comments