mirror of
https://github.com/holub/mame
synced 2025-05-30 17:41:47 +03:00
constexpr implies inline, generalise iabs, work around lack of C++14 constexpr in VS2015 (nw)
This commit is contained in:
parent
3917627494
commit
f88769555b
@ -433,12 +433,10 @@ inline u64 d2u(double d)
|
||||
|
||||
|
||||
// constexpr absolute value of an integer
|
||||
inline constexpr int iabs(int v)
|
||||
template <typename T>
|
||||
constexpr std::enable_if_t<std::is_signed<T>::value, T> iabs(T v)
|
||||
{
|
||||
if(v < 0)
|
||||
return -v;
|
||||
else
|
||||
return v;
|
||||
return (v < T(0)) ? -v : v;
|
||||
}
|
||||
|
||||
#endif /* MAME_EMU_EMUCORE_H */
|
||||
|
@ -894,7 +894,7 @@ class address_space_specific : public address_space
|
||||
u32 write_lookup(offs_t address) const { return Large ? m_write.lookup_live_large(address) : m_write.lookup_live_small(address); }
|
||||
u32 setoffset_lookup(offs_t address) const { return Large ? m_setoffset.lookup_live_large(address) : m_setoffset.lookup_live_small(address); }
|
||||
|
||||
static inline constexpr offs_t offset_to_byte(offs_t offset) { return AddrShift < 0 ? offset << iabs(AddrShift) : offset >> iabs(AddrShift); }
|
||||
static constexpr offs_t offset_to_byte(offs_t offset) { return AddrShift < 0 ? offset << iabs(AddrShift) : offset >> iabs(AddrShift); }
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
|
||||
void remove_intersecting_ranges(offs_t start, offs_t end);
|
||||
|
||||
static inline constexpr offs_t offset_to_byte(offs_t offset) { return AddrShift < 0 ? offset << iabs(AddrShift) : offset >> iabs(AddrShift); }
|
||||
static constexpr offs_t offset_to_byte(offs_t offset) { return AddrShift < 0 ? offset << iabs(AddrShift) : offset >> iabs(AddrShift); }
|
||||
|
||||
private:
|
||||
// internal helpers
|
||||
|
Loading…
Reference in New Issue
Block a user