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/exception/exception.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
|
||||
#include "../byteswap.hpp"
|
||||
|
||||
namespace fc {
|
||||
bigint::bigint( const char* bige, uint32_t l ) {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
#include <fc/variant.hpp>
|
||||
#include <fc/crypto/bigint.hpp>
|
||||
#include <stdexcept>
|
||||
#ifdef WIN32
|
||||
#include <WinSock2.h>
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include "byteswap.hpp"
|
||||
|
||||
namespace fc
|
||||
{
|
||||
|
|
@ -118,10 +114,9 @@ namespace fc
|
|||
}
|
||||
|
||||
|
||||
#define bswap64(y) (((uint64_t)ntohl(y)) << 32 | ntohl(y>>32))
|
||||
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) );
|
||||
return bi;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue