mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-22 19:49:36 +00:00
Initial test nicehash support.
This commit is contained in:
parent
e67a95bd8b
commit
2baccab0f9
4 changed files with 26 additions and 5 deletions
|
@ -48,6 +48,7 @@ bool opt_keepalive = false;
|
|||
bool opt_background = false;
|
||||
bool opt_double_hash = false;
|
||||
bool opt_safe = false;
|
||||
bool opt_nicehash = false;
|
||||
char *opt_url = NULL;
|
||||
char *opt_backup_url = NULL;
|
||||
char *opt_userpass = NULL;
|
||||
|
@ -97,6 +98,7 @@ static struct option const options[] = {
|
|||
{ "help", 0, NULL, 'h' },
|
||||
{ "keepalive", 0, NULL ,'k' },
|
||||
{ "max-cpu-usage", 1, NULL, 1004 },
|
||||
{ "nicehash", 0, NULL, 1006 },
|
||||
{ "no-color", 0, NULL, 1002 },
|
||||
{ "pass", 1, NULL, 'p' },
|
||||
{ "retries", 1, NULL, 'r' },
|
||||
|
@ -331,6 +333,10 @@ static void parse_arg(int key, char *arg) {
|
|||
opt_donate_level = v;
|
||||
break;
|
||||
|
||||
case 1006: /* --nicehash */
|
||||
opt_nicehash = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
show_usage_and_exit(1);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ extern bool opt_keepalive;
|
|||
extern bool opt_background;
|
||||
extern bool opt_double_hash;
|
||||
extern bool opt_safe;
|
||||
extern bool opt_nicehash;
|
||||
extern char *opt_url;
|
||||
extern char *opt_backup_url;
|
||||
extern char *opt_userpass;
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "Monero (XMR) CPU miner"
|
||||
#define APP_VERSION "0.8.0"
|
||||
#define APP_VERSION "0.8.1"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
|
||||
|
||||
#define APP_VER_MAJOR 0
|
||||
#define APP_VER_MINOR 8
|
||||
#define APP_VER_BUILD 0
|
||||
#define APP_VER_BUILD 1
|
||||
#define APP_VER_REV 0
|
||||
|
||||
#endif /* __VERSION_H__ */
|
||||
|
|
20
xmrig.c
20
xmrig.c
|
@ -280,7 +280,14 @@ static void *miner_thread(void *userdata) {
|
|||
if (memcmp(work.job_id, stratum_ctx->g_work.job_id, 64)) {
|
||||
work_copy(&work, &stratum_ctx->g_work);
|
||||
nonceptr = (uint32_t*) (((char*) work.blob) + 39);
|
||||
*nonceptr = 0xffffffffU / opt_n_threads * thr_id;
|
||||
|
||||
if (opt_nicehash) {
|
||||
end_nonce = (*nonceptr & 0xff000000U) + (0xffffffU / opt_n_threads * (thr_id + 1) - 0x20);
|
||||
*nonceptr = (*nonceptr & 0xff000000U) + (0xffffffU / opt_n_threads * thr_id);
|
||||
}
|
||||
else {
|
||||
*nonceptr = 0xffffffffU / opt_n_threads * thr_id;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&stratum_ctx->work_lock);
|
||||
|
@ -356,8 +363,15 @@ static void *miner_thread_double(void *userdata) {
|
|||
nonceptr0 = (uint32_t*) (((char*) double_blob) + 39);
|
||||
nonceptr1 = (uint32_t*) (((char*) double_blob) + 39 + work.blob_size);
|
||||
|
||||
*nonceptr0 = 0xffffffffU / (opt_n_threads * 2) * thr_id;
|
||||
*nonceptr1 = 0xffffffffU / (opt_n_threads * 2) * (thr_id + opt_n_threads);
|
||||
if (opt_nicehash) {
|
||||
end_nonce = (*nonceptr0 & 0xff000000U) + (0xffffffU / (opt_n_threads * 2) * (thr_id + 1) - 0x20);
|
||||
*nonceptr0 = (*nonceptr0 & 0xff000000U) + (0xffffffU / (opt_n_threads * 2) * thr_id);
|
||||
*nonceptr1 = (*nonceptr1 & 0xff000000U) + (0xffffffU / (opt_n_threads * 2) * (thr_id + opt_n_threads));
|
||||
}
|
||||
else {
|
||||
*nonceptr0 = 0xffffffffU / (opt_n_threads * 2) * thr_id;
|
||||
*nonceptr1 = 0xffffffffU / (opt_n_threads * 2) * (thr_id + opt_n_threads);
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&stratum_ctx->work_lock);
|
||||
|
|
Loading…
Reference in a new issue