mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
vfs_offset: Simplify TrimToFit()
We can simply use std::clamp() here, instead of using an equivalent with std::max() and std::min().
This commit is contained in:
parent
894b0de0f2
commit
3e0727df1b
@ -2,6 +2,7 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "core/file_sys/vfs_offset.h"
|
#include "core/file_sys/vfs_offset.h"
|
||||||
@ -88,7 +89,7 @@ size_t OffsetVfsFile::GetOffset() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const {
|
size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const {
|
||||||
return std::max<size_t>(std::min<size_t>(size - r_offset, r_size), 0);
|
return std::clamp(r_size, size_t{0}, size - r_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
Loading…
Reference in New Issue
Block a user