diff --git a/src/variant.cpp b/src/variant.cpp index 9eb6251..7a527e9 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -11,6 +11,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + namespace fc { @@ -675,12 +679,26 @@ void from_variant( const variant& var, std::vector& vo, uint32_t max_depth void to_variant( const uint128_t& var, variant& vo, uint32_t max_depth ) { +#ifdef __APPLE__ + boost::multiprecision::uint128_t helper = uint128_hi64( var ); + helper <<= 64; + helper += uint128_lo64( var ); + vo = boost::lexical_cast( helper ); +#else vo = boost::lexical_cast( var ); +#endif } void from_variant( const variant& var, uint128_t& vo, uint32_t max_depth ) { +#ifdef __APPLE__ + boost::multiprecision::uint128_t helper = boost::lexical_cast( var.as_string() ); + vo = static_cast( helper >> 64 ); + vo <<= 64; + vo += static_cast( helper & 0xffffffffffffffffULL ); +#else vo = boost::lexical_cast( var.as_string() ); +#endif } #ifdef __APPLE__