common/uint128: Apply nodiscard and noexcept where applicable
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
u128 Multiply64Into128(u64 a, u64 b) {
|
u128 Multiply64Into128(u64 a, u64 b) noexcept {
|
||||||
u128 result;
|
u128 result;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
result[0] = _umul128(a, b, &result[1]);
|
result[0] = _umul128(a, b, &result[1]);
|
||||||
@@ -24,7 +24,7 @@ u128 Multiply64Into128(u64 a, u64 b) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<u64, u64> Divide128On32(u128 dividend, u32 divisor) {
|
std::pair<u64, u64> Divide128On32(u128 dividend, u32 divisor) noexcept {
|
||||||
u64 remainder = dividend[0] % divisor;
|
u64 remainder = dividend[0] % divisor;
|
||||||
u64 accum = dividend[0] / divisor;
|
u64 accum = dividend[0] / divisor;
|
||||||
if (dividend[1] == 0)
|
if (dividend[1] == 0)
|
||||||
|
|||||||
@@ -10,10 +10,10 @@
|
|||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
// This function multiplies 2 u64 values and produces a u128 value;
|
// This function multiplies 2 u64 values and produces a u128 value;
|
||||||
u128 Multiply64Into128(u64 a, u64 b);
|
[[nodiscard]] u128 Multiply64Into128(u64 a, u64 b) noexcept;
|
||||||
|
|
||||||
// This function divides a u128 by a u32 value and produces two u64 values:
|
// This function divides a u128 by a u32 value and produces two u64 values:
|
||||||
// the result of division and the remainder
|
// the result of division and the remainder
|
||||||
std::pair<u64, u64> Divide128On32(u128 dividend, u32 divisor);
|
[[nodiscard]] std::pair<u64, u64> Divide128On32(u128 dividend, u32 divisor) noexcept;
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|||||||
Reference in New Issue
Block a user