File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ unsafe fn part1_inner(s: &str) -> u32 {
4343 let mut current = & mut [ 0u64 ; MAX_SIZE + 2 ] ;
4444
4545 let mut sum = 0 ;
46- ' outer : for ( x, y) in & zeros[ ..zeros_i] {
46+ for ( x, y) in & zeros[ ..zeros_i] {
4747 current[ * y + 1 ] |= 1 << * x;
4848 for layer in 0 ..9 {
4949 // for yp1 in 1..size + 1 {
@@ -59,21 +59,16 @@ unsafe fn part1_inner(s: &str) -> u32 {
5959 // }
6060 // println!("");
6161
62- let mut any = 0 ;
6362 for yp1 in 1 ..size + 1 {
6463 let to_left = ( current[ yp1] << 1 ) & maps[ layer] [ yp1] ;
6564 let to_right = ( current[ yp1] >> 1 ) & maps[ layer] [ yp1] ;
6665 let to_down = current[ yp1 - 1 ] & maps[ layer] [ yp1] ;
6766 let to_up = current[ yp1 + 1 ] & maps[ layer] [ yp1] ;
6867
69- let total = to_left | to_right | to_down | to_up;
70- any |= total;
71- next[ yp1] = total;
72- }
73- if any == 0 {
74- next. fill ( 0 ) ;
75- current. fill ( 0 ) ;
76- continue ' outer;
68+ let to_left_and_right = to_left | to_right;
69+ let to_left_down_and_right = to_left_and_right | to_down;
70+
71+ next[ yp1] = to_left_down_and_right | to_up;
7772 }
7873
7974 std:: mem:: swap ( & mut current, & mut next) ;
You can’t perform that action at this time.
0 commit comments