FC Updates from BitShares and myself #21
4 changed files with 24 additions and 3 deletions
|
|
@ -6,7 +6,12 @@ CMAKE_MINIMUM_REQUIRED( VERSION 3.1 )
|
||||||
|
|
||||||
set( CMAKE_CXX_STANDARD 14 )
|
set( CMAKE_CXX_STANDARD 14 )
|
||||||
SET( CMAKE_CXX_STANDARD_REQUIRED ON )
|
SET( CMAKE_CXX_STANDARD_REQUIRED ON )
|
||||||
set( CMAKE_CXX_EXTENSIONS OFF )
|
|
||||||
|
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
|
||||||
|
set( CMAKE_CXX_EXTENSIONS ON ) # for __int128 support
|
||||||
|
else( GNU )
|
||||||
|
set( CMAKE_CXX_EXTENSIONS OFF )
|
||||||
|
endif( GNU )
|
||||||
|
|
||||||
MESSAGE(STATUS "Configuring project fc located in: ${CMAKE_CURRENT_SOURCE_DIR}")
|
MESSAGE(STATUS "Configuring project fc located in: ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
SET( CMAKE_AUTOMOC OFF )
|
SET( CMAKE_AUTOMOC OFF )
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,19 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __SIZEOF_INT128__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace fc {
|
||||||
|
|
||||||
|
using int128_t = __int128_t;
|
||||||
|
using uint128_t = __uint128_t;
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
|
#else // __SIZEOF_INT128__
|
||||||
|
|
||||||
#include <boost/multiprecision/integer.hpp>
|
#include <boost/multiprecision/integer.hpp>
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
@ -32,3 +45,5 @@ using boost::multiprecision::int128_t;
|
||||||
using boost::multiprecision::uint128_t;
|
using boost::multiprecision::uint128_t;
|
||||||
|
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
||||||
|
#endif // __SIZEOF_INT128__
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
//#include <city.h>
|
//#include <city.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
#include <string.h> // for memcpy and memset
|
#include <string.h> // for memcpy and memset
|
||||||
#include <fc/crypto/city.hpp>
|
#include <fc/crypto/city.hpp>
|
||||||
#include <boost/endian/buffers.hpp>
|
#include <boost/endian/buffers.hpp>
|
||||||
|
|
|
||||||
|
|
@ -675,12 +675,12 @@ void from_variant( const variant& var, std::vector<char>& vo, uint32_t max_depth
|
||||||
|
|
||||||
void to_variant( const uint128_t& var, variant& vo, uint32_t max_depth )
|
void to_variant( const uint128_t& var, variant& vo, uint32_t max_depth )
|
||||||
{
|
{
|
||||||
vo = var.str();
|
vo = boost::lexical_cast<std::string>( var );
|
||||||
}
|
}
|
||||||
|
|
||||||
void from_variant( const variant& var, uint128_t& vo, uint32_t max_depth )
|
void from_variant( const variant& var, uint128_t& vo, uint32_t max_depth )
|
||||||
{
|
{
|
||||||
vo = uint128_t( var.as_string() );
|
vo = boost::lexical_cast<uint128_t>( var.as_string() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue