common/uint128: Apply nodiscard and noexcept where applicable

This commit is contained in:
Lioncash
2019-04-15 13:26:13 -04:00
parent 1c13186ec5
commit 1c23c2ec5e
2 changed files with 4 additions and 4 deletions

View File

@@ -12,7 +12,7 @@
namespace Common {
u128 Multiply64Into128(u64 a, u64 b) {
u128 Multiply64Into128(u64 a, u64 b) noexcept {
u128 result;
#ifdef _MSC_VER
result[0] = _umul128(a, b, &result[1]);
@@ -24,7 +24,7 @@ u128 Multiply64Into128(u64 a, u64 b) {
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 accum = dividend[0] / divisor;
if (dividend[1] == 0)

View File

@@ -10,10 +10,10 @@
namespace Common {
// 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:
// 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