From 51897881effec1d6e24bd3258935759a029a2e4a Mon Sep 17 00:00:00 2001 From: alion02 Date: Tue, 3 Dec 2024 01:22:06 +0100 Subject: [PATCH] Random stuff go --- src/day2.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/day2.rs b/src/day2.rs index e44ba12..4f8931d 100644 --- a/src/day2.rs +++ b/src/day2.rs @@ -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(); @@ -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; } @@ -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(); @@ -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; }