Clarify bitmagic.

[skip ci]
This commit is contained in:
2018-12-05 22:45:55 +01:00
parent f3d0297da5
commit 8fef472a58

View File

@@ -13,6 +13,9 @@ impl Day05 {
fn reduce(mut data: Vec<u8>) -> usize {
let mut dptr = 0;
for iptr in 0..data.len() {
// This originally had a nice comparison
// data[iptr] != data[dptr - 1] && data[iptr].eq_ignore_ascii_case(data[dptr - 1])
// However this is way faster, and does about the same
if dptr > 0 && (data[iptr] ^ data[dptr - 1]) == 32 {
dptr -= 1;
} else {