From eb2813d10fdab79706033430cb2b33d7885599c3 Mon Sep 17 00:00:00 2001 From: Louis Jeng Date: Mon, 14 Aug 2017 14:16:39 +0800 Subject: [PATCH] __int128 to support more than 64 CPUs --- cpu-miner.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cpu-miner.c b/cpu-miner.c index 9730fb62b..08a4af4a9 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -218,7 +218,11 @@ static int opt_scrypt_n = 1024; static int opt_pluck_n = 128; static unsigned int opt_nfactor = 6; int opt_n_threads = 0; +#ifdef __GNUC__ +__int128 opt_affinity = -1L; +#elif int64_t opt_affinity = -1L; +#endif int opt_priority = 0; int num_cpus; char *rpc_url; @@ -477,12 +481,20 @@ static inline void drop_policy(void) #define pthread_setaffinity_np(tid,sz,s) {} /* only do process affinity */ #endif +#ifdef __GNUC__ +static void affine_to_cpu_mask(int id, unsigned __int128 mask) { +#elif static void affine_to_cpu_mask(int id, unsigned long mask) { +#endif cpu_set_t set; CPU_ZERO(&set); for (uint8_t i = 0; i < num_cpus; i++) { // cpu mask +#ifdef __GNUC__ + if (mask & ((unsigned __int128)1UL<