mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
nil/copy: Use saturating_sub() instead of doing it manually
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36849>
This commit is contained in:
parent
fb04c68573
commit
e6c32c7b92
1 changed files with 1 additions and 5 deletions
|
|
@ -321,11 +321,7 @@ fn chunk_range(
|
|||
chunk_len: u32,
|
||||
) -> Range<u32> {
|
||||
debug_assert!(chunk_start < whole.end);
|
||||
let start = if chunk_start < whole.start {
|
||||
whole.start - chunk_start
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let start = whole.start.saturating_sub(chunk_start);
|
||||
let end = std::cmp::min(whole.end - chunk_start, chunk_len);
|
||||
start..end
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue