correct arithmetic adjustments

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry
2024-05-05 20:40:58 -04:00
committed by June
parent 16a98b0683
commit 321e197d8c
12 changed files with 24 additions and 53 deletions
+1 -5
View File
@@ -284,11 +284,7 @@ fn count_to_id(room_id: &RoomId, count: PduCount, offset: u64, subtract: bool) -
pdu_id.extend_from_slice(&0_u64.to_be_bytes());
let num = u64::MAX.saturating_sub(x);
if subtract {
if num > 0 {
num.saturating_sub(offset)
} else {
num
}
num.saturating_sub(offset)
} else {
num.saturating_add(offset)
}