diff options
| author | 2018-07-20 22:02:53 -0400 | |
|---|---|---|
| committer | 2018-07-20 22:04:37 -0400 | |
| commit | 3e0727df1b9354952dc7690dddd3a8239bcdadda (patch) | |
| tree | 338abfd6af45e7adbe190f51d268c02940415b86 /src | |
| parent | vfs: Make WriteBytes() overload taking a std::vector pass the std::vector by ... (diff) | |
| download | yuzu-3e0727df1b9354952dc7690dddd3a8239bcdadda.tar.gz yuzu-3e0727df1b9354952dc7690dddd3a8239bcdadda.tar.xz yuzu-3e0727df1b9354952dc7690dddd3a8239bcdadda.zip | |
vfs_offset: Simplify TrimToFit()
We can simply use std::clamp() here, instead of using an equivalent
with std::max() and std::min().
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/vfs_offset.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp index 38ec4e0f9..217e02235 100644 --- a/src/core/file_sys/vfs_offset.cpp +++ b/src/core/file_sys/vfs_offset.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include <utility> | 6 | #include <utility> |
| 6 | 7 | ||
| 7 | #include "core/file_sys/vfs_offset.h" | 8 | #include "core/file_sys/vfs_offset.h" |
| @@ -88,7 +89,7 @@ size_t OffsetVfsFile::GetOffset() const { | |||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const { | 91 | size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const { |
| 91 | return std::max<size_t>(std::min<size_t>(size - r_offset, r_size), 0); | 92 | return std::clamp(r_size, size_t{0}, size - r_offset); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | } // namespace FileSys | 95 | } // namespace FileSys |