Implement 2022 day 17 part 1

This commit is contained in:
2022-12-18 21:21:14 +01:00
parent a713d8690a
commit 594226320d
4 changed files with 128 additions and 2 deletions

View File

@@ -176,6 +176,15 @@ impl IndexSet {
true
}
}
pub fn contains(&self, index: usize) -> bool {
let (entry, pos) = Self::index(index);
self.0
.get(entry)
.map(|&entry| (entry & (1 << pos) != 0))
.unwrap_or(false)
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]