Port yuzu-emu/yuzu#4528: "common: Make use of [[nodiscard]] where applicable" (#5535)

Co-authored-by: LC <712067+lioncash@users.noreply.github.com>
This commit is contained in:
Tobias
2020-08-31 21:06:16 +02:00
committed by GitHub
parent e48110bdf4
commit f6b543886c
25 changed files with 284 additions and 265 deletions

View File

@ -8,7 +8,7 @@
namespace Common {
template <typename T>
constexpr T AlignUp(T value, std::size_t size) {
[[nodiscard]] constexpr T AlignUp(T value, std::size_t size) {
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
auto mod{value % size};
value -= mod;
@ -16,7 +16,7 @@ constexpr T AlignUp(T value, std::size_t size) {
}
template <typename T>
constexpr T AlignDown(T value, std::size_t size) {
[[nodiscard]] constexpr T AlignDown(T value, std::size_t size) {
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
return static_cast<T>(value - value % size);
}