2021-03-02 02:13:17 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
enum class DisplayMode
|
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
ShowHexIdent = 1 << 0,
|
|
|
|
ZeroExtend = 1 << 1,
|
|
|
|
AllHex = ShowHexIdent | ZeroExtend,
|
|
|
|
};
|
2020-04-08 11:44:49 +00:00
|
|
|
|
|
|
|
inline DisplayMode operator |(DisplayMode lhs, DisplayMode rhs)
|
|
|
|
{
|
|
|
|
using T = std::underlying_type<DisplayMode>::type;
|
|
|
|
return static_cast<DisplayMode>(static_cast<T>(lhs) | static_cast<T>(rhs));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DisplayMode& operator |=(DisplayMode& lhs, DisplayMode rhs)
|
|
|
|
{
|
|
|
|
lhs = lhs | rhs;
|
|
|
|
return lhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DisplayMode operator &(DisplayMode lhs, DisplayMode rhs)
|
|
|
|
{
|
|
|
|
using T = std::underlying_type<DisplayMode>::type;
|
|
|
|
return static_cast<DisplayMode>(static_cast<T>(lhs) & static_cast<T>(rhs));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DisplayMode& operator &=(DisplayMode& lhs, DisplayMode rhs)
|
|
|
|
{
|
|
|
|
lhs = lhs & rhs;
|
|
|
|
return lhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DisplayMode operator ^(DisplayMode lhs, DisplayMode rhs)
|
|
|
|
{
|
|
|
|
using T = std::underlying_type<DisplayMode>::type;
|
|
|
|
return static_cast<DisplayMode>((static_cast<T>(lhs) ^ static_cast<T>(rhs)) & static_cast<T>(DisplayMode::AllHex));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DisplayMode& operator ^=(DisplayMode& lhs, DisplayMode rhs)
|
|
|
|
{
|
|
|
|
lhs = lhs ^ rhs;
|
|
|
|
return lhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DisplayMode operator ~(DisplayMode lhs)
|
|
|
|
{
|
|
|
|
using T = std::underlying_type<DisplayMode>::type;
|
|
|
|
return static_cast<DisplayMode>(~static_cast<T>(lhs) & static_cast<T>(DisplayMode::AllHex));
|
|
|
|
}
|