mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-04 11:47:13 +00:00
Fix u128 constructors (MSVC)
This commit is contained in:
parent
33c3977036
commit
cb19316a17
@ -267,12 +267,20 @@ struct alignas(16) u128
|
||||
|
||||
u128() noexcept = default;
|
||||
|
||||
constexpr u128(u64 l) noexcept
|
||||
: lo(l)
|
||||
template <typename T, std::enable_if_t<std::is_unsigned_v<T>, u64> = 0>
|
||||
constexpr u128(T arg) noexcept
|
||||
: lo(arg)
|
||||
, hi(0)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<std::is_signed_v<T>, s64> = 0>
|
||||
constexpr u128(T arg) noexcept
|
||||
: lo(s64{arg})
|
||||
, hi(s64{arg} >> 63)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr explicit operator bool() const noexcept
|
||||
{
|
||||
return !!(lo | hi);
|
||||
@ -490,24 +498,9 @@ struct alignas(16) s128
|
||||
s64 hi;
|
||||
|
||||
s128() = default;
|
||||
|
||||
constexpr s128(s64 l)
|
||||
: hi(l >> 63)
|
||||
, lo(l)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr s128(u64 l)
|
||||
: hi(0)
|
||||
, lo(l)
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
CHECK_SIZE_ALIGN(u128, 16, 16);
|
||||
CHECK_SIZE_ALIGN(s128, 16, 16);
|
||||
|
||||
template <>
|
||||
struct get_int_impl<16>
|
||||
{
|
||||
|
@ -3,5 +3,8 @@
|
||||
|
||||
static_assert(std::endian::native == std::endian::little || std::endian::native == std::endian::big);
|
||||
|
||||
CHECK_SIZE_ALIGN(u128, 16, 16);
|
||||
CHECK_SIZE_ALIGN(s128, 16, 16);
|
||||
|
||||
static_assert(be_t<u16>(1) + be_t<u32>(2) + be_t<u64>(3) == 6);
|
||||
static_assert(le_t<u16>(1) + le_t<u32>(2) + le_t<u64>(3) == 6);
|
||||
|
Loading…
Reference in New Issue
Block a user