diff --git a/include/fc/io/enum_type.hpp b/include/fc/io/enum_type.hpp index bea0a73..c4bb024 100644 --- a/include/fc/io/enum_type.hpp +++ b/include/fc/io/enum_type.hpp @@ -26,16 +26,23 @@ namespace fc bool operator<( EnumType i ) { return value < i; } bool operator>( EnumType i ) { return value < i; } - friend bool operator==( enum_type e, IntType i ) { return e.value == (EnumType)i; } - friend bool operator==( enum_type e, EnumType i ) { return e.value == i; } + bool operator<(const enum_type& e) const { return value < e.value;} + bool operator>(const enum_type& e) const { return value > e.value;} + + bool operator<=(const enum_type& e) const { return value <= e.value;} + bool operator>=(const enum_type& e) const { return value >= e.value;} + + friend bool operator==( const enum_type& e, IntType i ){ return e.value == (EnumType)i;} + friend bool operator==( const enum_type& e, EnumType i ){ return e.value == i; } + + friend bool operator==( const enum_type& e, const enum_type& i ){ return e.value == i.value; } + friend bool operator==( IntType i, const enum_type& e){ return e.value == (EnumType)i; } + friend bool operator==( EnumType i, const enum_type& e ){ return e.value == i; } + + friend bool operator!=( const enum_type& e, IntType i ){ return e.value != (EnumType)i;} + friend bool operator!=( const enum_type& e, EnumType i ){ return e.value != i; } + friend bool operator!=( const enum_type& e, const enum_type& i ){ return e.value != i.value; } - friend bool operator==( enum_type e, enum_type i ) { return e.value == i.value; } - friend bool operator==( IntType i, enum_type e) { return e.value == (EnumType)i; } - friend bool operator==( EnumType i, enum_type e ) { return e.value == i; } - - friend bool operator!=( enum_type e, IntType i ) { return e.value != (EnumType)i; } - friend bool operator!=( enum_type e, EnumType i ) { return e.value != i; } - friend bool operator!=( enum_type e, enum_type i ) { return e.value != i.value; } EnumType value; }; diff --git a/include/fc/io/raw.hpp b/include/fc/io/raw.hpp index 7c84cd6..874483d 100644 --- a/include/fc/io/raw.hpp +++ b/include/fc/io/raw.hpp @@ -106,7 +106,7 @@ namespace fc { v |= uint32_t(uint8_t(b) & 0x7f) << by; by += 7; } while( uint8_t(b) & 0x80 ); - vi.value = v; + vi.value = static_cast(v); } template inline void pack( Stream& s, const char* v ) { pack( s, fc::string(v) ); } @@ -153,7 +153,7 @@ namespace fc { // bool template inline void pack( Stream& s, const bool& v ) { pack( s, uint8_t(v) ); } - template inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=b; } + template inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=(b!=0); } namespace detail { diff --git a/include/fc/time.hpp b/include/fc/time.hpp index dd28bfc..c5ae58a 100644 --- a/include/fc/time.hpp +++ b/include/fc/time.hpp @@ -3,6 +3,11 @@ #include #include +#ifdef _MSC_VER + #pragma warning (push) + #pragma warning (disable : 4244) +#endif //// _MSC_VER + namespace fc { class microseconds { public: @@ -87,3 +92,7 @@ namespace fc { typedef fc::optional otime_point; } + +#ifdef _MSC_VER + #pragma warning (pop) +#endif /// #ifdef _MSC_VER diff --git a/include/fc/uint128.hpp b/include/fc/uint128.hpp index 2d84c4f..aab14f2 100644 --- a/include/fc/uint128.hpp +++ b/include/fc/uint128.hpp @@ -2,6 +2,11 @@ #include #include +#ifdef _MSC_VER + #pragma warning (push) + #pragma warning (disable : 4244) +#endif //// _MSC_VER + namespace fc { class bigint; @@ -110,3 +115,7 @@ namespace std } }; } + +#ifdef _MSC_VER + #pragma warning (pop) +#endif ///_MSC_VER diff --git a/include/fc/utility.hpp b/include/fc/utility.hpp index 0c6c77e..098d9d0 100644 --- a/include/fc/utility.hpp +++ b/include/fc/utility.hpp @@ -59,3 +59,7 @@ namespace fc { a = fc::move(b); b = fc::move(tmp); } + +#define LLCONST(constant) static_cast(constant##ll) +#define ULLCONST(constant) static_cast(constant##ull) +