diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-02-16 01:04:11 +0100 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-02-16 03:57:16 +0100 |
commit | ecccfe033777d6ae7d29bcf0cfc30412f7d3be24 (patch) | |
tree | f6504e5f766a6f8675764124f7d231843de40583 /src/common/uint128.h | |
parent | Implement 128 bits Unsigned Integer Multiplication and Division. (diff) | |
download | yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.tar yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.tar.gz yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.tar.bz2 yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.tar.lz yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.tar.xz yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.tar.zst yuzu-ecccfe033777d6ae7d29bcf0cfc30412f7d3be24.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/uint128.h | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/common/uint128.h b/src/common/uint128.h index fda313bcc..45e384c33 100644 --- a/src/common/uint128.h +++ b/src/common/uint128.h @@ -1,30 +1,13 @@ #include <array> #include <cstdint> -#include <utility> #include <cstring> +#include <utility> #include "common/common_types.h" namespace Common { -#ifdef _MSC_VER -#include <intrin.h> - -#pragma intrinsic(_umul128) -#endif - -inline u128 umul128(u64 a, u64 b) { -#ifdef _MSC_VER -u128 result; -result[0] = _umul128(a, b, &result[1]); -#else -unsigned __int128 tmp = a; -tmp *= b; -u128 result; -std::memcpy(&result, &tmp, sizeof(u128)); -#endif -return result; -} +u128 Multiply64Into128(u64 a, u64 b); -std::pair<u64, u64> udiv128(u128 dividend, u64 divisor); +std::pair<u64, u64> Divide128On64(u128 dividend, u64 divisor); } // namespace Common |