Merge branch 'phoenix' of https://github.com/InvictusInnovations/fc into phoenix
This commit is contained in:
commit
e2e416bf80
3 changed files with 14 additions and 17 deletions
11
src/byteswap.hpp
Normal file
11
src/byteswap.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# include <stdlib.h>
|
||||||
|
# define bswap_64(x) _byteswap_uint64(x)
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
# include <libkern/OSByteOrder.h>
|
||||||
|
# define bswap_64(x) OSSwapInt64(x)
|
||||||
|
#else
|
||||||
|
# include <byteswap.h>
|
||||||
|
#endif
|
||||||
|
|
@ -5,16 +5,7 @@
|
||||||
#include <fc/crypto/base64.hpp>
|
#include <fc/crypto/base64.hpp>
|
||||||
|
|
||||||
#include <fc/exception/exception.hpp>
|
#include <fc/exception/exception.hpp>
|
||||||
|
#include "../byteswap.hpp"
|
||||||
#ifdef _MSC_VER
|
|
||||||
# include <stdlib.h>
|
|
||||||
# define bswap_64(x) _byteswap_uint64(x)
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
# include <libkern/OSByteOrder.h>
|
|
||||||
# define bswap_64(x) OSSwapInt64(x)
|
|
||||||
#else
|
|
||||||
# include <byteswap.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
bigint::bigint( const char* bige, uint32_t l ) {
|
bigint::bigint( const char* bige, uint32_t l ) {
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,7 @@
|
||||||
#include <fc/variant.hpp>
|
#include <fc/variant.hpp>
|
||||||
#include <fc/crypto/bigint.hpp>
|
#include <fc/crypto/bigint.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#ifdef WIN32
|
#include "byteswap.hpp"
|
||||||
#include <WinSock2.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace fc
|
namespace fc
|
||||||
{
|
{
|
||||||
|
|
@ -118,10 +114,9 @@ namespace fc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define bswap64(y) (((uint64_t)ntohl(y)) << 32 | ntohl(y>>32))
|
|
||||||
uint128::operator bigint()const
|
uint128::operator bigint()const
|
||||||
{
|
{
|
||||||
auto tmp = uint128( bswap64( hi ), bswap64( lo ) );
|
auto tmp = uint128( bswap_64( hi ), bswap_64( lo ) );
|
||||||
bigint bi( (char*)&tmp, sizeof(tmp) );
|
bigint bi( (char*)&tmp, sizeof(tmp) );
|
||||||
return bi;
|
return bi;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue