Add address lookup table program (#21616)

* Add address lookup table program

* feedback
This commit is contained in:
Justin Starry
2021-12-10 16:02:16 -05:00
committed by GitHub
parent a5a0dabe7b
commit 9b41ddd9ba
21 changed files with 1665 additions and 4 deletions

View File

@ -25,6 +25,9 @@ impl SlotHashes {
}
(self.0).truncate(MAX_ENTRIES);
}
pub fn position(&self, slot: &Slot) -> Option<usize> {
self.binary_search_by(|(probe, _)| slot.cmp(probe)).ok()
}
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn get(&self, slot: &Slot) -> Option<&Hash> {
self.binary_search_by(|(probe, _)| slot.cmp(probe))