From 94896d9dafd7ef1e56c85a81861667098e93613c Mon Sep 17 00:00:00 2001 From: Haifa Bogdan Adnan Date: Wed, 15 Aug 2018 23:33:08 +0300 Subject: [PATCH] Fixes for stupid long int size of 32bit in windows and other small fixes. --- .gitignore | 10 ++ common/common.h | 2 +- hash/argon2/argon2.cpp | 7 +- hash/cpu/cpu_hasher.cpp | 2 +- hash/gpu/gpu_hasher.cpp | 18 +-- http/http.cpp | 19 +-- miner/mini-gmp/mini-gmp.c | 132 +++++++++--------- miner/mini-gmp/mini-gmp.h | 83 +++++------ .../argon2_fill_blocks.vcxproj | 38 +++-- win32/ariominer/ariominer.sln | 11 +- win32/ariominer/ariominer.vcxproj | 43 +++--- win32/ariominer/ariominer.vcxproj.filters | 32 +++-- win32/tdr_delay.reg | Bin 0 -> 278 bytes ...ty_layer.c => win64_compatibility_layer.c} | 13 +- ...ty_layer.h => win64_compatibility_layer.h} | 15 +- 15 files changed, 230 insertions(+), 195 deletions(-) create mode 100644 .gitignore create mode 100644 win32/tdr_delay.reg rename win32/{win32_compatibility_layer.c => win64_compatibility_layer.c} (79%) mode change 100755 => 100644 rename win32/{win32_compatibility_layer.h => win64_compatibility_layer.h} (68%) mode change 100755 => 100644 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d35a601 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs +/win32/argon2_fill_blocks/x64 +/win32/ariominer/.vs/ariominer/v15 +/win32/ariominer/ariominer.vcxproj.user +/win32/argon2_fill_blocks/argon2_fill_blocks.vcxproj.user +/win32/ariominer/x64 diff --git a/common/common.h b/common/common.h index 312786c..da78ca8 100755 --- a/common/common.h +++ b/common/common.h @@ -26,7 +26,7 @@ #include #include #else -#include +#include #endif #include diff --git a/hash/argon2/argon2.cpp b/hash/argon2/argon2.cpp index 163ca2e..bc1c3a3 100755 --- a/hash/argon2/argon2.cpp +++ b/hash/argon2/argon2.cpp @@ -16,6 +16,7 @@ argon2::argon2(argon2_blocks_filler_ptr filler, void *seed_memory, void *user_da __seed_memory_offset = argon2profile_default->memsize; __lane_length = -1; __user_data = user_data; + srand(microseconds()); } vector argon2::generate_hashes(const argon2profile &profile, const string &base, const string &salt_) { @@ -102,13 +103,13 @@ void argon2::__initial_hash(const argon2profile &profile, uint8_t *blockhash, co value = ARGON2_TYPE_VALUE; blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value)); - value = base.length(); + value = (uint32_t)base.length(); blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value)); blake2b_update(&BlakeHash, (const uint8_t *)base.c_str(), base.length()); - value = salt.length(); + value = (uint32_t)salt.length(); blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value)); blake2b_update(&BlakeHash, (const uint8_t *)salt.c_str(), @@ -150,7 +151,7 @@ string argon2::__encode_string(const argon2profile &profile, const string &salt, char salt_b64[50]; char hash_b64[50]; - mg_base64_encode((unsigned char *)salt.c_str(), salt.length(), salt_b64); + mg_base64_encode((unsigned char *)salt.c_str(), (int)salt.length(), salt_b64); mg_base64_encode(hash, ARGON2_RAW_LENGTH, hash_b64); salt_b64[22] = 0; diff --git a/hash/cpu/cpu_hasher.cpp b/hash/cpu/cpu_hasher.cpp index a45877b..66cd963 100755 --- a/hash/cpu/cpu_hasher.cpp +++ b/hash/cpu/cpu_hasher.cpp @@ -187,7 +187,7 @@ void cpu_hasher::__run() { if(!input.base.empty()) { hash_factory.set_seed_memory_offset(profile->memsize); - hash_factory.set_threads(argon2profile_default->memsize / profile->memsize); + hash_factory.set_threads((int)(argon2profile_default->memsize / profile->memsize)); vector hashes = hash_factory.generate_hashes(*profile, input.base, input.salt); for(vector::iterator it = hashes.begin(); it != hashes.end(); ++it) { diff --git a/hash/gpu/gpu_hasher.cpp b/hash/gpu/gpu_hasher.cpp index 0804983..a3748f7 100755 --- a/hash/gpu/gpu_hasher.cpp +++ b/hash/gpu/gpu_hasher.cpp @@ -479,7 +479,7 @@ bool gpu_hasher::configure(arguments &args) { return false; } - _intensity = (intensity_cpu + intensity_gpu) / 2.0; + _intensity = (int)((intensity_cpu + intensity_gpu) / 2.0); __running = true; for(vector::iterator d = __devices.begin(); d != __devices.end(); d++) { @@ -520,8 +520,8 @@ void kernel_filler(void *memory, int threads, argon2profile *profile, void *user clSetKernelArg(device->kernel, 9, sizeof(device->arguments.seed_memory), &device->arguments.seed_memory); - size_t total_work_items = threads * 32; - size_t local_work_items = 32; + size_t total_work_items = threads * KERNEL_WORKGROUP_SIZE; + size_t local_work_items = KERNEL_WORKGROUP_SIZE; uint32_t threads_per_chunk; uint32_t memsize; @@ -531,16 +531,16 @@ void kernel_filler(void *memory, int threads, argon2profile *profile, void *user if(strcmp(profile->profile_name, "1_1_524288") == 0) { threads_per_chunk = device->profile_info.threads_per_chunk_profile_1_1_524288; - memsize = argon2profile_1_1_524288.memsize; - addrsize = argon2profile_1_1_524288.block_refs_size; - xor_limit = argon2profile_1_1_524288.xor_limit; + memsize = (uint32_t)argon2profile_1_1_524288.memsize; + addrsize = (uint32_t)argon2profile_1_1_524288.block_refs_size; + xor_limit = (uint32_t)argon2profile_1_1_524288.xor_limit; profile_id = 0; } else { threads_per_chunk = device->profile_info.threads_per_chunk_profile_4_4_16384; - memsize = argon2profile_4_4_16384.memsize; - addrsize = argon2profile_4_4_16384.block_refs_size; - xor_limit = argon2profile_4_4_16384.xor_limit; + memsize = (uint32_t)argon2profile_4_4_16384.memsize; + addrsize = (uint32_t)argon2profile_4_4_16384.block_refs_size; + xor_limit = (uint32_t)argon2profile_4_4_16384.xor_limit; profile_id = 1; } diff --git a/http/http.cpp b/http/http.cpp index 2caddc2..b5583ea 100755 --- a/http/http.cpp +++ b/http/http.cpp @@ -14,7 +14,7 @@ struct http_result_response { }; static void mg_ev_handler(struct mg_connection *c, int ev, void *p) { - if (ev == MG_EV_HTTP_REPLY) { + if (ev == MG_EV_HTTP_REPLY) { http_message *hm = (http_message *)p; c->flags |= MG_F_CLOSE_IMMEDIATELY; strncpy(((http_result_response*)(c->user_data))->reply, hm->body.p, hm->body.len); @@ -51,15 +51,15 @@ string http::__http_post(const string &url, const string &post_data) { post_data.empty() ? NULL : "Content-Type: application/x-www-form-urlencoded\r\n", post_data.empty() ? NULL : post_data.c_str()); - char *result = (char *)malloc(1000); - http_result_response http_rsp; - http_rsp.reply = result; - http_rsp.reply_received = false; - conn->user_data = (void *)&http_rsp; + char *result = new char[1000]; + http_result_response *http_rsp = new http_result_response(); + http_rsp->reply = result; + http_rsp->reply_received = false; + conn->user_data = (void *)http_rsp; time_t initial_timestamp = time(NULL); - while(!(http_rsp.reply_received)) { - if(time(NULL) - initial_timestamp > 10) { //10 sec timeout + while(!(http_rsp->reply_received)) { + if(time(NULL) - initial_timestamp > 30) { //30 sec timeout return string(""); } if(!__poll_running) { @@ -72,7 +72,8 @@ string http::__http_post(const string &url, const string &post_data) { string t = result; if(time(NULL) - initial_timestamp <= 10) { - free(result); + delete[] result; + delete http_rsp; } return t; } diff --git a/miner/mini-gmp/mini-gmp.c b/miner/mini-gmp/mini-gmp.c index 54c0c7c..6a41174 100644 --- a/miner/mini-gmp/mini-gmp.c +++ b/miner/mini-gmp/mini-gmp.c @@ -60,8 +60,8 @@ see https://www.gnu.org/licenses/. */ #define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2)) #define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1) -#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT) -#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1)) +#define GMP_ULONG_BITS (sizeof(uint64_t) * CHAR_BIT) +#define GMP_ULONG_HIGHBIT ((uint64_t) 1 << (GMP_ULONG_BITS - 1)) #define GMP_ABS(x) ((x) >= 0 ? (x) : -(x)) #define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1)) @@ -1436,19 +1436,19 @@ mpz_realloc (mpz_t r, mp_size_t size) /* MPZ assignment and basic conversions. */ void -mpz_set_si (mpz_t r, signed long int x) +mpz_set_si (mpz_t r, int64_t x) { if (x >= 0) mpz_set_ui (r, x); else /* (x < 0) */ { r->_mp_size = -1; - MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x); + MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (uint64_t, x); } } void -mpz_set_ui (mpz_t r, unsigned long int x) +mpz_set_ui (mpz_t r, uint64_t x) { if (x > 0) { @@ -1477,14 +1477,14 @@ mpz_set (mpz_t r, const mpz_t x) } void -mpz_init_set_si (mpz_t r, signed long int x) +mpz_init_set_si (mpz_t r, int64_t x) { mpz_init (r); mpz_set_si (r, x); } void -mpz_init_set_ui (mpz_t r, unsigned long int x) +mpz_init_set_ui (mpz_t r, uint64_t x) { mpz_init (r); mpz_set_ui (r, x); @@ -1518,7 +1518,7 @@ mpz_fits_ulong_p (const mpz_t u) return (us == (us > 0)); } -long int +int64_t mpz_get_si (const mpz_t u) { mp_size_t us = u->_mp_size; @@ -1531,7 +1531,7 @@ mpz_get_si (const mpz_t u) return 0; } -unsigned long int +uint64_t mpz_get_ui (const mpz_t u) { return u->_mp_size == 0 ? 0 : u->_mp_d[0]; @@ -1760,15 +1760,15 @@ mpz_cmp_si (const mpz_t u, long v) else /* usize == -1 */ { mp_limb_t ul = u->_mp_d[0]; - if ((mp_limb_t)GMP_NEG_CAST (unsigned long int, v) < ul) + if ((mp_limb_t)GMP_NEG_CAST (uint64_t, v) < ul) return -1; else - return (mp_limb_t)GMP_NEG_CAST (unsigned long int, v) > ul; + return (mp_limb_t)GMP_NEG_CAST (uint64_t, v) > ul; } } int -mpz_cmp_ui (const mpz_t u, unsigned long v) +mpz_cmp_ui (const mpz_t u, uint64_t v) { mp_size_t usize = u->_mp_size; @@ -1798,7 +1798,7 @@ mpz_cmp (const mpz_t a, const mpz_t b) } int -mpz_cmpabs_ui (const mpz_t u, unsigned long v) +mpz_cmpabs_ui (const mpz_t u, uint64_t v) { mp_size_t un = GMP_ABS (u->_mp_size); mp_limb_t ul; @@ -1845,7 +1845,7 @@ mpz_swap (mpz_t u, mpz_t v) /* Adds to the absolute value. Returns new size, but doesn't store it. */ static mp_size_t -mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b) +mpz_abs_add_ui (mpz_t r, const mpz_t a, uint64_t b) { mp_size_t an; mp_ptr rp; @@ -1870,7 +1870,7 @@ mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b) /* Subtract from the absolute value. Returns new size, (or -1 on underflow), but doesn't store it. */ static mp_size_t -mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b) +mpz_abs_sub_ui (mpz_t r, const mpz_t a, uint64_t b) { mp_size_t an = GMP_ABS (a->_mp_size); mp_ptr rp; @@ -1894,7 +1894,7 @@ mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b) } void -mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b) +mpz_add_ui (mpz_t r, const mpz_t a, uint64_t b) { if (a->_mp_size >= 0) r->_mp_size = mpz_abs_add_ui (r, a, b); @@ -1903,7 +1903,7 @@ mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b) } void -mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b) +mpz_sub_ui (mpz_t r, const mpz_t a, uint64_t b) { if (a->_mp_size < 0) r->_mp_size = -mpz_abs_add_ui (r, a, b); @@ -1912,7 +1912,7 @@ mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b) } void -mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b) +mpz_ui_sub (mpz_t r, uint64_t a, const mpz_t b) { if (b->_mp_size < 0) r->_mp_size = mpz_abs_add_ui (r, b, a); @@ -1996,19 +1996,19 @@ mpz_sub (mpz_t r, const mpz_t a, const mpz_t b) /* MPZ multiplication */ void -mpz_mul_si (mpz_t r, const mpz_t u, long int v) +mpz_mul_si (mpz_t r, const mpz_t u, int64_t v) { if (v < 0) { - mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v)); + mpz_mul_ui (r, u, GMP_NEG_CAST (uint64_t, v)); mpz_neg (r, r); } else - mpz_mul_ui (r, u, (unsigned long int) v); + mpz_mul_ui (r, u, (uint64_t) v); } void -mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v) +mpz_mul_ui (mpz_t r, const mpz_t u, uint64_t v) { mp_size_t un, us; mp_ptr tp; @@ -2105,7 +2105,7 @@ mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits) } void -mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v) +mpz_addmul_ui (mpz_t r, const mpz_t u, uint64_t v) { mpz_t t; mpz_init (t); @@ -2115,7 +2115,7 @@ mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v) } void -mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v) +mpz_submul_ui (mpz_t r, const mpz_t u, uint64_t v) { mpz_t t; mpz_init (t); @@ -2511,9 +2511,9 @@ mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m) return res; } -static unsigned long +static uint64_t mpz_div_qr_ui (mpz_t q, mpz_t r, - const mpz_t n, unsigned long d, enum mpz_div_round_mode mode) + const mpz_t n, uint64_t d, enum mpz_div_round_mode mode) { mp_size_t ns, qn; mp_ptr qp; @@ -2567,90 +2567,90 @@ mpz_div_qr_ui (mpz_t q, mpz_t r, return rl; } -unsigned long -mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL); } -unsigned long -mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR); } -unsigned long -mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC); } -unsigned long -mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d) +uint64_t +mpz_cdiv_q_ui (mpz_t q, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL); } -unsigned long -mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d) +uint64_t +mpz_fdiv_q_ui (mpz_t q, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR); } -unsigned long -mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d) +uint64_t +mpz_tdiv_q_ui (mpz_t q, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC); } -unsigned long -mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_cdiv_r_ui (mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL); } -unsigned long -mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_fdiv_r_ui (mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR); } -unsigned long -mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_tdiv_r_ui (mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC); } -unsigned long -mpz_cdiv_ui (const mpz_t n, unsigned long d) +uint64_t +mpz_cdiv_ui (const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL); } -unsigned long -mpz_fdiv_ui (const mpz_t n, unsigned long d) +uint64_t +mpz_fdiv_ui (const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR); } -unsigned long -mpz_tdiv_ui (const mpz_t n, unsigned long d) +uint64_t +mpz_tdiv_ui (const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC); } -unsigned long -mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d) +uint64_t +mpz_mod_ui (mpz_t r, const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR); } void -mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d) +mpz_divexact_ui (mpz_t q, const mpz_t n, uint64_t d) { gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC)); } int -mpz_divisible_ui_p (const mpz_t n, unsigned long d) +mpz_divisible_ui_p (const mpz_t n, uint64_t d) { return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0; } @@ -2700,8 +2700,8 @@ mpn_gcd_11 (mp_limb_t u, mp_limb_t v) return u << shift; } -unsigned long -mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v) +uint64_t +mpz_gcd_ui (mpz_t g, const mpz_t u, uint64_t v) { mp_size_t un; @@ -3003,7 +3003,7 @@ mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v) } void -mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v) +mpz_lcm_ui (mpz_t r, const mpz_t u, uint64_t v) { if (v == 0 || u->_mp_size == 0) { @@ -3053,9 +3053,9 @@ mpz_invert (mpz_t r, const mpz_t u, const mpz_t m) /* Higher level operations (sqrt, pow and root) */ void -mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e) +mpz_pow_ui (mpz_t r, const mpz_t b, uint64_t e) { - unsigned long bit; + uint64_t bit; mpz_t tr; mpz_init_set_ui (tr, 1); @@ -3074,7 +3074,7 @@ mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e) } void -mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e) +mpz_ui_pow_ui (mpz_t r, uint64_t blimb, uint64_t e) { mpz_t b; mpz_pow_ui (r, mpz_roinit_n (b, &blimb, 1), e); @@ -3186,7 +3186,7 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m) } void -mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m) +mpz_powm_ui (mpz_t r, const mpz_t b, uint64_t elimb, const mpz_t m) { mpz_t e; mpz_powm (r, b, mpz_roinit_n (e, &elimb, 1), m); @@ -3194,7 +3194,7 @@ mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m) /* x=trunc(y^(1/z)), r=y-x^z */ void -mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z) +mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, uint64_t z) { int sgn; mpz_t t, u; @@ -3254,7 +3254,7 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z) } int -mpz_root (mpz_t x, const mpz_t y, unsigned long z) +mpz_root (mpz_t x, const mpz_t y, uint64_t z) { int res; mpz_t r; @@ -3325,7 +3325,7 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n) /* Combinatorics */ void -mpz_fac_ui (mpz_t x, unsigned long n) +mpz_fac_ui (mpz_t x, uint64_t n) { mpz_set_ui (x, n + (n == 0)); while (n > 2) @@ -3333,7 +3333,7 @@ mpz_fac_ui (mpz_t x, unsigned long n) } void -mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k) +mpz_bin_uiui (mpz_t r, uint64_t n, uint64_t k) { mpz_t t; @@ -3431,7 +3431,7 @@ mpz_probab_prime_p (const mpz_t n, int reps) for (j = 0, is_prime = 1; is_prime & (j < reps); j++) { - mpz_set_ui (y, (unsigned long) j*j+j+41); + mpz_set_ui (y, (uint64_t) j*j+j+41); if (mpz_cmp (y, nm1) >= 0) { /* Don't try any further bases. This "early" break does not affect diff --git a/miner/mini-gmp/mini-gmp.h b/miner/mini-gmp/mini-gmp.h index bf6be64..ea3c738 100644 --- a/miner/mini-gmp/mini-gmp.h +++ b/miner/mini-gmp/mini-gmp.h @@ -40,6 +40,7 @@ see https://www.gnu.org/licenses/. */ /* For size_t */ #include +#include #if defined (__cplusplus) extern "C" { @@ -53,9 +54,9 @@ void mp_get_memory_functions (void *(**) (size_t), void *(**) (void *, size_t, size_t), void (**) (void *, size_t)); -typedef unsigned long mp_limb_t; +typedef uint64_t mp_limb_t; typedef long mp_size_t; -typedef unsigned long mp_bitcnt_t; +typedef uint64_t mp_bitcnt_t; typedef mp_limb_t *mp_ptr; typedef const mp_limb_t *mp_srcptr; @@ -128,9 +129,9 @@ void mpz_clear (mpz_t); int mpz_sgn (const mpz_t); int mpz_cmp_si (const mpz_t, long); -int mpz_cmp_ui (const mpz_t, unsigned long); +int mpz_cmp_ui (const mpz_t, uint64_t); int mpz_cmp (const mpz_t, const mpz_t); -int mpz_cmpabs_ui (const mpz_t, unsigned long); +int mpz_cmpabs_ui (const mpz_t, uint64_t); int mpz_cmpabs (const mpz_t, const mpz_t); int mpz_cmp_d (const mpz_t, double); int mpz_cmpabs_d (const mpz_t, double); @@ -139,19 +140,19 @@ void mpz_abs (mpz_t, const mpz_t); void mpz_neg (mpz_t, const mpz_t); void mpz_swap (mpz_t, mpz_t); -void mpz_add_ui (mpz_t, const mpz_t, unsigned long); +void mpz_add_ui (mpz_t, const mpz_t, uint64_t); void mpz_add (mpz_t, const mpz_t, const mpz_t); -void mpz_sub_ui (mpz_t, const mpz_t, unsigned long); -void mpz_ui_sub (mpz_t, unsigned long, const mpz_t); +void mpz_sub_ui (mpz_t, const mpz_t, uint64_t); +void mpz_ui_sub (mpz_t, uint64_t, const mpz_t); void mpz_sub (mpz_t, const mpz_t, const mpz_t); -void mpz_mul_si (mpz_t, const mpz_t, long int); -void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_mul_si (mpz_t, const mpz_t, int64_t); +void mpz_mul_ui (mpz_t, const mpz_t, uint64_t); void mpz_mul (mpz_t, const mpz_t, const mpz_t); void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t); -void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_addmul_ui (mpz_t, const mpz_t, uint64_t); void mpz_addmul (mpz_t, const mpz_t, const mpz_t); -void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_submul_ui (mpz_t, const mpz_t, uint64_t); void mpz_submul (mpz_t, const mpz_t, const mpz_t); void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); @@ -178,29 +179,29 @@ void mpz_divexact (mpz_t, const mpz_t, const mpz_t); int mpz_divisible_p (const mpz_t, const mpz_t); int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t); -unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); -unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); -unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); -unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long); -unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long); -unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long); -unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long); -unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long); -unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long); -unsigned long mpz_cdiv_ui (const mpz_t, unsigned long); -unsigned long mpz_fdiv_ui (const mpz_t, unsigned long); -unsigned long mpz_tdiv_ui (const mpz_t, unsigned long); +uint64_t mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, uint64_t); +uint64_t mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, uint64_t); +uint64_t mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, uint64_t); +uint64_t mpz_cdiv_q_ui (mpz_t, const mpz_t, uint64_t); +uint64_t mpz_fdiv_q_ui (mpz_t, const mpz_t, uint64_t); +uint64_t mpz_tdiv_q_ui (mpz_t, const mpz_t, uint64_t); +uint64_t mpz_cdiv_r_ui (mpz_t, const mpz_t, uint64_t); +uint64_t mpz_fdiv_r_ui (mpz_t, const mpz_t, uint64_t); +uint64_t mpz_tdiv_r_ui (mpz_t, const mpz_t, uint64_t); +uint64_t mpz_cdiv_ui (const mpz_t, uint64_t); +uint64_t mpz_fdiv_ui (const mpz_t, uint64_t); +uint64_t mpz_tdiv_ui (const mpz_t, uint64_t); -unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long); +uint64_t mpz_mod_ui (mpz_t, const mpz_t, uint64_t); -void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long); +void mpz_divexact_ui (mpz_t, const mpz_t, uint64_t); -int mpz_divisible_ui_p (const mpz_t, unsigned long); +int mpz_divisible_ui_p (const mpz_t, uint64_t); -unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long); +uint64_t mpz_gcd_ui (mpz_t, const mpz_t, uint64_t); void mpz_gcd (mpz_t, const mpz_t, const mpz_t); void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t); -void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long); +void mpz_lcm_ui (mpz_t, const mpz_t, uint64_t); void mpz_lcm (mpz_t, const mpz_t, const mpz_t); int mpz_invert (mpz_t, const mpz_t, const mpz_t); @@ -208,16 +209,16 @@ void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t); void mpz_sqrt (mpz_t, const mpz_t); int mpz_perfect_square_p (const mpz_t); -void mpz_pow_ui (mpz_t, const mpz_t, unsigned long); -void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long); +void mpz_pow_ui (mpz_t, const mpz_t, uint64_t); +void mpz_ui_pow_ui (mpz_t, uint64_t, uint64_t); void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t); -void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t); +void mpz_powm_ui (mpz_t, const mpz_t, uint64_t, const mpz_t); -void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long); -int mpz_root (mpz_t, const mpz_t, unsigned long); +void mpz_rootrem (mpz_t, mpz_t, const mpz_t, uint64_t); +int mpz_root (mpz_t, const mpz_t, uint64_t); -void mpz_fac_ui (mpz_t, unsigned long); -void mpz_bin_uiui (mpz_t, unsigned long, unsigned long); +void mpz_fac_ui (mpz_t, uint64_t); +void mpz_bin_uiui (mpz_t, uint64_t, uint64_t); int mpz_probab_prime_p (const mpz_t, int); @@ -238,8 +239,8 @@ mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t); int mpz_fits_slong_p (const mpz_t); int mpz_fits_ulong_p (const mpz_t); -long int mpz_get_si (const mpz_t); -unsigned long int mpz_get_ui (const mpz_t); +int64_t mpz_get_si (const mpz_t); +uint64_t mpz_get_ui (const mpz_t); double mpz_get_d (const mpz_t); size_t mpz_size (const mpz_t); mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t); @@ -253,13 +254,13 @@ mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t); #define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }} -void mpz_set_si (mpz_t, signed long int); -void mpz_set_ui (mpz_t, unsigned long int); +void mpz_set_si (mpz_t, int64_t); +void mpz_set_ui (mpz_t, uint64_t); void mpz_set (mpz_t, const mpz_t); void mpz_set_d (mpz_t, double); -void mpz_init_set_si (mpz_t, signed long int); -void mpz_init_set_ui (mpz_t, unsigned long int); +void mpz_init_set_si (mpz_t, int64_t); +void mpz_init_set_ui (mpz_t, uint64_t); void mpz_init_set (mpz_t, const mpz_t); void mpz_init_set_d (mpz_t, double); diff --git a/win32/argon2_fill_blocks/argon2_fill_blocks.vcxproj b/win32/argon2_fill_blocks/argon2_fill_blocks.vcxproj index 8881f10..0335199 100755 --- a/win32/argon2_fill_blocks/argon2_fill_blocks.vcxproj +++ b/win32/argon2_fill_blocks/argon2_fill_blocks.vcxproj @@ -1,5 +1,5 @@  - + Debug-AVX2 @@ -55,71 +55,71 @@ {971243BA-4A01-427A-B7CD-517ED125BEAF} Win32Proj argon2_fill_blocks - 8.1 + 10.0.17134.0 DynamicLibrary true - v140 + Intel C++ Compiler 18.0 Unicode DynamicLibrary true - v140 + Intel C++ Compiler 18.0 Unicode DynamicLibrary true - v140 + Intel C++ Compiler 18.0 Unicode DynamicLibrary true - v140 + Intel C++ Compiler 18.0 Unicode DynamicLibrary true - v140 + Intel C++ Compiler 18.0 Unicode DynamicLibrary false - v140 + Intel C++ Compiler 18.0 true Unicode DynamicLibrary false - v140 + Intel C++ Compiler 18.0 true Unicode DynamicLibrary false - v140 + Intel C++ Compiler 18.0 true Unicode DynamicLibrary false - v140 + Intel C++ Compiler 18.0 true Unicode DynamicLibrary false - v140 + Intel C++ Compiler 18.0 true Unicode @@ -302,6 +302,10 @@ true NDEBUG;_WINDOWS;_USRDLL;ARGON2_FILL_BLOCKS_EXPORTS;%(PreprocessorDefinitions) MultiThreaded + AdvancedVectorExtensions2 + CORE512 + true + true Windows @@ -321,6 +325,9 @@ NDEBUG;_WINDOWS;_USRDLL;ARGON2_FILL_BLOCKS_EXPORTS;%(PreprocessorDefinitions) AdvancedVectorExtensions2 MultiThreaded + true + true + AVX2 Windows @@ -338,8 +345,11 @@ true true NDEBUG;_WINDOWS;_USRDLL;ARGON2_FILL_BLOCKS_EXPORTS;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 + StreamingSIMDExtensions3 MultiThreaded + true + true + SSSE3 Windows @@ -359,6 +369,8 @@ NDEBUG;_WINDOWS;_USRDLL;ARGON2_FILL_BLOCKS_EXPORTS;%(PreprocessorDefinitions) StreamingSIMDExtensions2 MultiThreaded + true + true Windows diff --git a/win32/ariominer/ariominer.sln b/win32/ariominer/ariominer.sln index aee2f83..5f2242c 100755 --- a/win32/ariominer/ariominer.sln +++ b/win32/ariominer/ariominer.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ariominer", "ariominer.vcxproj", "{907DB311-1F34-4C68-9929-606992D97A88}" EndProject @@ -13,8 +13,8 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {907DB311-1F34-4C68-9929-606992D97A88}.Debug|x64.ActiveCfg = Debug_AMD|x64 - {907DB311-1F34-4C68-9929-606992D97A88}.Debug|x64.Build.0 = Debug_AMD|x64 + {907DB311-1F34-4C68-9929-606992D97A88}.Debug|x64.ActiveCfg = Debug_NVIDIA|x64 + {907DB311-1F34-4C68-9929-606992D97A88}.Debug|x64.Build.0 = Debug_NVIDIA|x64 {907DB311-1F34-4C68-9929-606992D97A88}.Release|x64.ActiveCfg = Release_Intel|x64 {907DB311-1F34-4C68-9929-606992D97A88}.Release|x64.Build.0 = Release_Intel|x64 {971243BA-4A01-427A-B7CD-517ED125BEAF}.Debug|x64.ActiveCfg = Debug-REF|x64 @@ -25,4 +25,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7D52D62A-F5DD-4252-BF65-8DEE07E99D1E} + EndGlobalSection EndGlobal diff --git a/win32/ariominer/ariominer.vcxproj b/win32/ariominer/ariominer.vcxproj index 4959644..38f9ce2 100755 --- a/win32/ariominer/ariominer.vcxproj +++ b/win32/ariominer/ariominer.vcxproj @@ -1,5 +1,5 @@  - + Debug_AMD @@ -30,45 +30,45 @@ {907DB311-1F34-4C68-9929-606992D97A88} Win32Proj ariominer - 8.1 + 10.0.17134.0 Application true - v140 + Intel C++ Compiler 18.0 Unicode Application true - v140 + Intel C++ Compiler 18.0 Unicode Application true - v140 + Intel C++ Compiler 18.0 Unicode Application false - v140 + Intel C++ Compiler 18.0 true Unicode Application false - v140 + Intel C++ Compiler 18.0 true Unicode Application false - v140 + Intel C++ Compiler 18.0 true Unicode @@ -99,26 +99,32 @@ true $(ProjectName)_Intel + $(SolutionDir)$(Platform)\Debug true $(ProjectName)_AMD + $(SolutionDir)$(Platform)\Debug true $(ProjectName)_NVIDIA + $(SolutionDir)$(Platform)\Debug false $(ProjectName)_Intel + $(SolutionDir)$(Platform)\Release false $(ProjectName)_AMD + $(SolutionDir)$(Platform)\Release false $(ProjectName)_NVIDIA + $(SolutionDir)$(Platform)\Release @@ -128,7 +134,7 @@ Disabled STACK_LINE_READER_BUFFER_SIZE=1024;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(INTELOCLSDKROOT)include;../;../dlfcn;../../hash/cpu/cpu_features/include;%(AdditionalIncludeDirectories) - MultiThreadedDebug + MultiThreaded Console @@ -145,7 +151,7 @@ Disabled STACK_LINE_READER_BUFFER_SIZE=1024;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(INTELOCLSDKROOT)include;../;../dlfcn;../../hash/cpu/cpu_features/include;%(AdditionalIncludeDirectories) - MultiThreadedDebug + MultiThreaded Console @@ -161,14 +167,14 @@ Level3 Disabled STACK_LINE_READER_BUFFER_SIZE=1024;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include;../;../dlfcn;../../hash/cpu/cpu_features/include;%(AdditionalIncludeDirectories) + C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include;../;../dlfcn;../../hash/cpu/cpu_features/include;%(AdditionalIncludeDirectories) MultiThreadedDebug Console true OpenCL.lib;psapi.lib;%(AdditionalDependencies) - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\x64;%(AdditionalLibraryDirectories) + C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64;%(AdditionalLibraryDirectories) @@ -222,8 +228,10 @@ true true STACK_LINE_READER_BUFFER_SIZE=1024;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include;../;../dlfcn;../../hash/cpu/cpu_features/include;%(AdditionalIncludeDirectories) + C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include;../;../dlfcn;../../hash/cpu/cpu_features/include;%(AdditionalIncludeDirectories) MultiThreaded + true + true Console @@ -231,7 +239,7 @@ true true OpenCL.lib;psapi.lib;%(AdditionalDependencies) - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\x64;%(AdditionalLibraryDirectories) + C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64;%(AdditionalLibraryDirectories) @@ -267,7 +275,7 @@ - + @@ -305,7 +313,10 @@ - + + + + diff --git a/win32/ariominer/ariominer.vcxproj.filters b/win32/ariominer/ariominer.vcxproj.filters index 70641da..c588b09 100755 --- a/win32/ariominer/ariominer.vcxproj.filters +++ b/win32/ariominer/ariominer.vcxproj.filters @@ -94,11 +94,11 @@ proxy - - win32 - - win32\dlfcn + win64\dlfcn + + + win64 @@ -199,16 +199,16 @@ proxy - win32 - - - win32 + win64 - win32\dlfcn + win64\dlfcn - win32 + win64 + + + win64 @@ -263,11 +263,19 @@ {56c8891a-451c-4c5d-9073-ff4126249cec} - + + {e779a155-f27b-4dca-b23a-7da4c7d18330} + + {bf0c4301-9c14-4f68-9cce-8c2996a54c7b} - + {0f4541e7-e9f8-4c09-88f9-ec41c598e07e} + + + resources + + \ No newline at end of file diff --git a/win32/tdr_delay.reg b/win32/tdr_delay.reg new file mode 100644 index 0000000000000000000000000000000000000000..a2952e95fbd13a3f80041631f623d3cb55754177 GIT binary patch literal 278 zcmXw!-D<)>5Jt~+q3tv_usec = (long)(tmpres % 1000000UL); } - if (NULL != tz) - { - if (!tzflag) - { - _tzset(); - tzflag++; - } -// tz->tz_minuteswest = _timezone / 60; -// tz->tz_dsttime = _daylight; - } - return 0; } \ No newline at end of file diff --git a/win32/win32_compatibility_layer.h b/win32/win64_compatibility_layer.h old mode 100755 new mode 100644 similarity index 68% rename from win32/win32_compatibility_layer.h rename to win32/win64_compatibility_layer.h index 44ea64f..42d8376 --- a/win32/win32_compatibility_layer.h +++ b/win32/win64_compatibility_layer.h @@ -2,18 +2,17 @@ // Created by Haifa Bogdan Adnan on 13/08/2018. // -#ifndef ARIOMINER_WIN32_COMPATIBILITY_LAYER_H -#define ARIOMINER_WIN32_COMPATIBILITY_LAYER_H +#ifndef ARIOMINER_WIN64_COMPATIBILITY_LAYER_H +#define ARIOMINER_WIN64_COMPATIBILITY_LAYER_H -//#include #include -#ifdef __cplusplus -extern "C" { -#endif +#ifdef __cplusplus +extern "C" { +#endif int gettimeofday(struct timeval *tv, struct timezone *tz); -#ifdef __cplusplus -} +#ifdef __cplusplus +} #endif #endif //ARIOMINER_WIN32_COMPATIBILITY_LAYER_H