mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Provide endian_flipX functions to avoid special casing big endian in cgminer.c
This commit is contained in:
parent
8d81f1d207
commit
4597c0a17e
@ -1481,9 +1481,7 @@ static void calc_midstate(struct work *work)
|
||||
sha2_starts(&ctx);
|
||||
sha2_update(&ctx, data, 64);
|
||||
memcpy(work->midstate, ctx.state, 32);
|
||||
#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
|
||||
flip32(work->midstate, work->midstate);
|
||||
#endif
|
||||
endian_flip32(work->midstate, work->midstate);
|
||||
}
|
||||
|
||||
static struct work *make_work(void)
|
||||
@ -2439,9 +2437,7 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
|
||||
|
||||
cgpu = get_thr_cgpu(thr_id);
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
flip128(work->data, work->data);
|
||||
#endif
|
||||
endian_flip128(work->data, work->data);
|
||||
|
||||
/* build hex string */
|
||||
hexstr = bin2hex(work->data, sizeof(work->data));
|
||||
|
23
miner.h
23
miner.h
@ -670,6 +670,29 @@ static inline void flip128(void *dest_p, const void *src_p)
|
||||
dest[i] = swab32(src[i]);
|
||||
}
|
||||
|
||||
/* For flipping to the correct endianness if necessary */
|
||||
#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
|
||||
static inline void endian_flip32(void *dest_p, const void *src_p)
|
||||
{
|
||||
flip32(dest_p, src_p);
|
||||
}
|
||||
|
||||
static inline void endian_flip128(void *dest_p, const void *src_p)
|
||||
{
|
||||
flip128(dest_p, src_p);
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
endian_flip32(void __maybe_unused *dest_p, const void __maybe_unused *src_p)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
endian_flip128(void __maybe_unused *dest_p, const void __maybe_unused *src_p)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void quit(int status, const char *format, ...);
|
||||
|
||||
static inline void mutex_lock(pthread_mutex_t *lock)
|
||||
|
Loading…
Reference in New Issue
Block a user