Improve unix compilation
This commit is contained in:
parent
997390b278
commit
12c18b9ba5
12 changed files with 29 additions and 17 deletions
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
class SubmitResult;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "interfaces/interface.h"
|
||||
|
||||
#include "align.h"
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ void (* const extra_hashes[4])(const void*, size_t, char*) = {do_blake_hash, do_
|
|||
|
||||
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_AMD64)
|
||||
#if (defined(__x86_64__) || defined(_M_AMD64)) && __cplusplus > 199711L
|
||||
# define EXTRACT64(X) _mm_cvtsi128_si64(X)
|
||||
|
||||
# ifdef __GNUC__
|
||||
|
@ -88,7 +88,7 @@ static inline uint64_t __umul128(uint64_t a, uint64_t b, uint64_t* hi)
|
|||
# else
|
||||
#define __umul128 _umul128
|
||||
# endif
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
#elif defined(__i386__) || defined(_M_IX86) || __cplusplus <= 199711L
|
||||
# define HI32(X) \
|
||||
_mm_srli_si128((X), 4)
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ static inline uint32_t sub_word(uint32_t key)
|
|||
saes_sbox[key & 0xff];
|
||||
}
|
||||
|
||||
#if defined(__clang__) || defined(XMRIG_ARM)
|
||||
#if defined(__clang__) || defined(XMRIG_ARM) || __cplusplus <= 199711L
|
||||
static inline uint32_t _rotr(uint32_t value, uint32_t amount)
|
||||
{
|
||||
return (value >> amount) | (value << ((32 - amount) & 31));
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#ifndef __ICONSOLELISTENER_H__
|
||||
#define __ICONSOLELISTENER_H__
|
||||
|
||||
#include "interfaces/interface.h"
|
||||
|
||||
class IConsoleListener
|
||||
{
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
#ifndef __INTERFACE_H__
|
||||
#define __INTERFACE_H__
|
||||
|
||||
#if __cplusplus <= 199711L
|
||||
#define override
|
||||
#define nullptr NULL
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
|
||||
// C++-11
|
||||
#define override
|
||||
|
||||
// VS
|
||||
#include <vadefs.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -89,9 +89,10 @@ public:
|
|||
|
||||
static inline std::string TO_STRING(const std::basic_ostream<char> & i)
|
||||
{
|
||||
const std::stringstream & stream = static_cast<const std::stringstream &>(i);
|
||||
const std::ostringstream & stream = static_cast<const std::ostringstream &>(i);
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
private:
|
||||
inline Log() {}
|
||||
~Log();
|
||||
|
@ -101,22 +102,22 @@ private:
|
|||
};
|
||||
|
||||
|
||||
#define PRINT_MSG(x) Log::i()->text(Log::TO_STRING(std::stringstream() << x))
|
||||
#define PRINT_MSG(x) Log::i()->text(Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
|
||||
#define LOG_ERR(x) Log::i()->message(ILogBackend::ERR, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_WARN(x) Log::i()->message(ILogBackend::WARNING, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_NOTICE(x) Log::i()->message(ILogBackend::NOTICE, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_INFO(x) Log::i()->message(ILogBackend::INFO, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_ERR(x) Log::i()->message(ILogBackend::ERR, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
#define LOG_WARN(x) Log::i()->message(ILogBackend::WARNING, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
#define LOG_NOTICE(x) Log::i()->message(ILogBackend::NOTICE, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
#define LOG_INFO(x) Log::i()->message(ILogBackend::INFO, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
#define LOG_DEBUG(x) Log::i()->message(ILogBackend::DEBUG, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_DEBUG(x) Log::i()->message(ILogBackend::DEBUG, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
#else
|
||||
#define LOG_DEBUG(x)
|
||||
#endif
|
||||
|
||||
#if defined(APP_DEBUG) || defined(APP_DEVEL)
|
||||
#define LOG_DEBUG_ERR(x) Log::i()->message(ILogBackend::ERR, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_DEBUG_WARN(x) Log::i()->message(ILogBackend::WARNING, Log::TO_STRING(std::stringstream() << x))
|
||||
#define LOG_DEBUG_ERR(x) Log::i()->message(ILogBackend::ERR, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
#define LOG_DEBUG_WARN(x) Log::i()->message(ILogBackend::WARNING, Log::TO_STRING(std::ostringstream() << " " << x))
|
||||
#else
|
||||
#define LOG_DEBUG_ERR(x)
|
||||
#define LOG_DEBUG_WARN(x)
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "interfaces/interface.h"
|
||||
|
||||
class Url
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#ifndef _WIN32
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
class DoubleWorker::State
|
||||
|
@ -70,7 +71,7 @@ void DoubleWorker::start()
|
|||
#ifdef _WIN32
|
||||
Sleep(200);
|
||||
#else
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
usleep(200 * 1000);
|
||||
#endif
|
||||
}
|
||||
while(Workers::isPaused());
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <stdint.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include "interfaces/interface.h"
|
||||
|
||||
class IWorker;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#ifndef _WIN32
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
SingleWorker::SingleWorker(Handle* handle)
|
||||
|
@ -46,7 +47,7 @@ void SingleWorker::start()
|
|||
#ifdef _WIN32
|
||||
Sleep(200);
|
||||
#else
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
usleep(200 * 1000);
|
||||
#endif
|
||||
}
|
||||
while(Workers::isPaused());
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "net/Job.h"
|
||||
#include "net/JobResult.h"
|
||||
|
||||
#include "interfaces/interface.h"
|
||||
|
||||
class Handle;
|
||||
class Hashrate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue