From 6072fe811157d259573485895eb489fbf588d40b Mon Sep 17 00:00:00 2001 From: Warlock-Dalbaeb Date: Thu, 17 Aug 2017 03:02:21 +0700 Subject: [PATCH] Windows --- vanity.hpp | 4 +++- vanitygen.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vanity.hpp b/vanity.hpp index a50e6f6..8fe7772 100644 --- a/vanity.hpp +++ b/vanity.hpp @@ -9,7 +9,9 @@ #include #include #include - +#ifdef _WIN32 +#include +#endif // sha256 #define Ch(x, y, z) ((x & (y ^ z)) ^ z) #define Maj(x, y, z) ((x & (y | z)) | (y & z)) diff --git a/vanitygen.cpp b/vanitygen.cpp index a64d857..a1f88e0 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -279,10 +279,19 @@ if(type != i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519){ KeyBuf = new uint8_t[keys.GetFullLen()]; keys.ToBuffer (KeyBuf, keys.GetFullLen ()); - +#ifdef __linux__ if(!count_cpu) count_cpu = sysconf(_SC_NPROCESSORS_ONLN); - +#elif _WIN32 + if(!count_cpu){ + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + count_cpu = sysinfo.dwNumberOfProcessors; + } +#else + if(!count_cpu) + count_cpu = 4; +#endif std::cout << "Start vanity generator in " << count_cpu << " threads" << std::endl;