mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 17:01:24 +12:00
Small fix
This commit is contained in:
parent
317417d541
commit
c0fdef7a12
2 changed files with 20 additions and 2 deletions
|
@ -68,14 +68,16 @@ namespace vm
|
||||||
return m_addr != 0;
|
return m_addr != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test address alignment using alignof(T)
|
||||||
bool aligned() const
|
bool aligned() const
|
||||||
{
|
{
|
||||||
return m_addr % alignof32(T) == 0;
|
return m_addr % alignof32(T) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator %(to_ne_t<AT> alignment)
|
// test address for arbitrary alignment or something
|
||||||
|
force_inline explicit_bool_t operator %(to_ne_t<AT> right) const
|
||||||
{
|
{
|
||||||
return m_addr % alignment != 0;
|
return m_addr % right;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ptr_base& operator =(const _ptr_base&) = default;
|
_ptr_base& operator =(const _ptr_base&) = default;
|
||||||
|
|
|
@ -61,6 +61,22 @@ template<typename T, typename = std::enable_if_t<std::is_integral<T>::value>> in
|
||||||
return static_cast<T>((value + (align - 1)) & ~(align - 1));
|
return static_cast<T>((value + (align - 1)) & ~(align - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bool wrapper for restricting bool result conversions
|
||||||
|
struct explicit_bool_t
|
||||||
|
{
|
||||||
|
const bool value;
|
||||||
|
|
||||||
|
explicit_bool_t(bool value)
|
||||||
|
: value(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit operator bool() const
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
|
// return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
|
||||||
#define sizeof32(type) sizeof32_t<sizeof(type)>::value
|
#define sizeof32(type) sizeof32_t<sizeof(type)>::value
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue