mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Use a standard function for flipping bytes.
This commit is contained in:
parent
734f3d1c54
commit
0ba5f0f94b
@ -2300,13 +2300,7 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
|
|||||||
unsigned char data[80];
|
unsigned char data[80];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 80 / 4; i++) {
|
flip256(data, work->data);
|
||||||
uint32_t *src32, *dst32;
|
|
||||||
|
|
||||||
src32 = (uint32_t *)&work->data[i * 4];
|
|
||||||
dst32 = (uint32_t *)&data[i * 4];
|
|
||||||
*dst32 = swab32(*src32);
|
|
||||||
}
|
|
||||||
header = bin2hex(data, 80);
|
header = bin2hex(data, 80);
|
||||||
sprintf(gbt_block, "%s", header);
|
sprintf(gbt_block, "%s", header);
|
||||||
free(header);
|
free(header);
|
||||||
|
10
miner.h
10
miner.h
@ -544,6 +544,16 @@ static inline void swab256(void *dest_p, const void *src_p)
|
|||||||
dest[7] = swab32(src[0]);
|
dest[7] = swab32(src[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void flip256(void *dest_p, const void *src_p)
|
||||||
|
{
|
||||||
|
uint32_t *dest = dest_p;
|
||||||
|
const uint32_t *src = src_p;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
dest[i] = swab32(src[i]);
|
||||||
|
}
|
||||||
|
|
||||||
extern void quit(int status, const char *format, ...);
|
extern void quit(int status, const char *format, ...);
|
||||||
|
|
||||||
static inline void mutex_lock(pthread_mutex_t *lock)
|
static inline void mutex_lock(pthread_mutex_t *lock)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user