Merge branch 'phoenix' of github.com:InvictusInnovations/fc into phoenix

This commit is contained in:
Daniel Larimer 2014-01-29 17:07:31 -05:00
commit fa85f98844
5 changed files with 40 additions and 11 deletions

View file

@ -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;
};

View file

@ -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<uint32_t>(v);
}
template<typename Stream> inline void pack( Stream& s, const char* v ) { pack( s, fc::string(v) ); }
@ -153,7 +153,7 @@ namespace fc {
// bool
template<typename Stream> inline void pack( Stream& s, const bool& v ) { pack( s, uint8_t(v) ); }
template<typename Stream> inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=b; }
template<typename Stream> inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=(b!=0); }
namespace detail {

View file

@ -3,6 +3,11 @@
#include <fc/string.hpp>
#include <fc/optional.hpp>
#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<time_point> otime_point;
}
#ifdef _MSC_VER
#pragma warning (pop)
#endif /// #ifdef _MSC_VER

View file

@ -2,6 +2,11 @@
#include <stdint.h>
#include <string>
#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

View file

@ -59,3 +59,7 @@ namespace fc {
a = fc::move(b);
b = fc::move(tmp);
}
#define LLCONST(constant) static_cast<int64_t>(constant##ll)
#define ULLCONST(constant) static_cast<uint64_t>(constant##ull)