mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-04 22:11:18 +12:00
Cleanup udiv128 (#206)
This commit is contained in:
parent
4eaa600b57
commit
6cdb6eed17
4 changed files with 9 additions and 19 deletions
|
@ -210,6 +210,15 @@ typedef union _LARGE_INTEGER {
|
|||
inline T& operator^= (T& a, T b) { return reinterpret_cast<T&>( reinterpret_cast<std::underlying_type<T>::type&>(a) ^= static_cast<std::underlying_type<T>::type>(b) ); }
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__clang__) // clang-cl does not have built-in _udiv128
|
||||
inline uint64 _udiv128(uint64 highDividend, uint64 lowDividend, uint64 divisor, uint64 *remainder)
|
||||
{
|
||||
unsigned __int128 dividend = (((unsigned __int128)highDividend) << 64) | ((unsigned __int128)lowDividend);
|
||||
*remainder = (uint64)((dividend % divisor) & 0xFFFFFFFFFFFFFFFF);
|
||||
return (uint64)((dividend / divisor) & 0xFFFFFFFFFFFFFFFF);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define UNREACHABLE __assume(false)
|
||||
#elif defined(__GNUC__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue