mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-31 00:44:19 +00:00
VS2010 build: revert le256todouble() cast/ref/deref change.
Introduced by commit 87e5f35745321132cea3e5b21ddb7d69e8a8eb0f The cast/ref/deref is performed wrong and breaks share/best share display. It is not the value of target that should be increased, but its address. If all else fails, add an `#ifdef _MSVC_VER`; we should avoid it if possible. In either case, constructs like `&(*(((uint64_t *)target) + 24))` must be explained (in a comment).
This commit is contained in:
parent
8d25b38e9b
commit
d9eb547c5a
11
sgminer.c
11
sgminer.c
@ -2521,7 +2521,7 @@ static void show_hash(struct work *work, char *hashshow)
|
|||||||
intdiff = round(work->work_difficulty);
|
intdiff = round(work->work_difficulty);
|
||||||
suffix_string(work->share_diff, diffdisp, sizeof (diffdisp), 0);
|
suffix_string(work->share_diff, diffdisp, sizeof (diffdisp), 0);
|
||||||
snprintf(hashshow, 64, "%08lx Diff %s/%d%s", h32, diffdisp, intdiff,
|
snprintf(hashshow, 64, "%08lx Diff %s/%d%s", h32, diffdisp, intdiff,
|
||||||
work->block? " BLOCK!" : "");
|
work->block ? " BLOCK!" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
@ -2901,16 +2901,16 @@ static double le256todouble(const void *target)
|
|||||||
uint64_t *data64;
|
uint64_t *data64;
|
||||||
double dcut64;
|
double dcut64;
|
||||||
|
|
||||||
data64 = &(*(((uint64_t *)target) + 24));
|
data64 = (uint64_t *)(target + 24);
|
||||||
dcut64 = le64toh(*data64) * bits192;
|
dcut64 = le64toh(*data64) * bits192;
|
||||||
|
|
||||||
data64 = &(*(((uint64_t *)target) + 16));
|
data64 = (uint64_t *)(target + 16);
|
||||||
dcut64 += le64toh(*data64) * bits128;
|
dcut64 += le64toh(*data64) * bits128;
|
||||||
|
|
||||||
data64 = &(*(((uint64_t *)target) + 8));
|
data64 = (uint64_t *)(target + 8);
|
||||||
dcut64 += le64toh(*data64) * bits64;
|
dcut64 += le64toh(*data64) * bits64;
|
||||||
|
|
||||||
data64 = (uint64_t *)(target);
|
data64 = (uint64_t *)target;
|
||||||
dcut64 += le64toh(*data64);
|
dcut64 += le64toh(*data64);
|
||||||
|
|
||||||
return dcut64;
|
return dcut64;
|
||||||
@ -3557,6 +3557,7 @@ static uint64_t share_diff(const struct work *work)
|
|||||||
s64 = 0;
|
s64 = 0;
|
||||||
|
|
||||||
ret = round(d64 / s64);
|
ret = round(d64 / s64);
|
||||||
|
applog(LOG_DEBUG, "Found share with difficulty %lu", ret);
|
||||||
|
|
||||||
cg_wlock(&control_lock);
|
cg_wlock(&control_lock);
|
||||||
if (unlikely(ret > best_diff)) {
|
if (unlikely(ret > best_diff)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user