Skip to content

Commit

Permalink
Random stuff go
Browse files Browse the repository at this point in the history
  • Loading branch information
alion02 committed Dec 3, 2024
1 parent c4e7221 commit 5189788
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/day2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ unsafe fn inner1(s: &str) -> u32 {
loop {
let diff = v1.wrapping_sub(v0).wrapping_sub(1);

if diff > 2 {
if unlikely(diff > 2) {
let chunk =
(s.get_unchecked(i - 1) as *const _ as *const u8x32).read_unaligned();

Expand All @@ -45,7 +45,7 @@ unsafe fn inner1(s: &str) -> u32 {
break;
}

if *s.get_unchecked(i - 1) == b'\n' {
if unlikely(*s.get_unchecked(i - 1) == b'\n') {
sum += 1;
break;
}
Expand All @@ -58,7 +58,7 @@ unsafe fn inner1(s: &str) -> u32 {
loop {
let diff = v0.wrapping_sub(v1).wrapping_sub(1);

if diff > 2 {
if unlikely(diff > 2) {
let chunk =
(s.get_unchecked(i - 1) as *const _ as *const u8x32).read_unaligned();

Expand All @@ -69,7 +69,7 @@ unsafe fn inner1(s: &str) -> u32 {
break;
}

if *s.get_unchecked(i - 1) == b'\n' {
if unlikely(*s.get_unchecked(i - 1) == b'\n') {
sum += 1;
break;
}
Expand Down

0 comments on commit 5189788

Please sign in to comment.