#pragma once namespace nall { template struct Real { static_assert(Precision == 32 || Precision == 64); static inline constexpr auto bits() -> uint { return Precision; } using ftype = conditional_t>; inline Real() : data(0.0) {} template inline Real(Real value) : data((ftype)value) {} template inline Real(const T& value) : data((ftype)value) {} explicit inline Real(const char* value) : data((ftype)toReal(value)) {} inline operator ftype() const { return data; } inline auto operator++(int) { auto value = *this; ++data; return value; } inline auto operator--(int) { auto value = *this; --data; return value; } inline auto& operator++() { data++; return *this; } inline auto& operator--() { data--; return *this; } template inline auto& operator =(const T& value) { data = value; return *this; } template inline auto& operator*=(const T& value) { data = data * value; return *this; } template inline auto& operator/=(const T& value) { data = data / value; return *this; } template inline auto& operator%=(const T& value) { data = data % value; return *this; } template inline auto& operator+=(const T& value) { data = data + value; return *this; } template inline auto& operator-=(const T& value) { data = data - value; return *this; } inline auto serialize(serializer& s) { s(data); } private: ftype data; }; }