Prevent underflow with saturating_sub(1) (#812) (#817)

This commit is contained in:
Johannes
2025-04-01 09:51:03 +02:00
committed by GitHub
parent 176c3bae14
commit 3855592447
2 changed files with 5 additions and 4 deletions

View File

@@ -58,8 +58,9 @@ impl ParallelInteractionGroups {
let range = self.groups[i]..self.groups[i + 1];
&self.sorted_interactions[range]
}
pub fn num_groups(&self) -> usize {
self.groups.len() - 1
self.groups.len().saturating_sub(1)
}
pub fn group_interactions<Interaction: PairInteraction>(