From 14c6f8699e6dbf4ed66adfa8e87f8a56e37f084f Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 27 Jun 2017 18:47:33 +0300 Subject: [PATCH] Fix --cpu-affinity overflow, again. --- src/Cpu.h | 5 ++++- src/Cpu_unix.cpp | 2 +- src/Cpu_win.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Cpu.h b/src/Cpu.h index 292c6c6c3..7f1f76141 100644 --- a/src/Cpu.h +++ b/src/Cpu.h @@ -25,6 +25,9 @@ #define __CPU_H__ +#include + + class Cpu { public: @@ -36,7 +39,7 @@ public: static int optimalThreadsCount(int algo, bool doubleHash, int maxCpuUsage); static void init(); - static void setAffinity(int id, unsigned long mask); + static void setAffinity(int id, uint64_t mask); static inline bool hasAES() { return m_flags & AES; } static inline bool isX64() { return m_flags & X86_64; } diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp index 1b7c6b0a8..925e0c0a0 100644 --- a/src/Cpu_unix.cpp +++ b/src/Cpu_unix.cpp @@ -40,7 +40,7 @@ void Cpu::init() } -void Cpu::setAffinity(int id, unsigned long mask) +void Cpu::setAffinity(int id, uint64_t mask) { cpu_set_t set; CPU_ZERO(&set); diff --git a/src/Cpu_win.cpp b/src/Cpu_win.cpp index fe4ea0ba4..13113a178 100644 --- a/src/Cpu_win.cpp +++ b/src/Cpu_win.cpp @@ -41,7 +41,7 @@ void Cpu::init() } -void Cpu::setAffinity(int id, unsigned long mask) +void Cpu::setAffinity(int id, uint64_t mask) { if (id == -1) { SetProcessAffinityMask(GetCurrentProcess(), mask);