Browse Source

Use a standard function for flipping bytes.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
0ba5f0f94b
  1. 8
      cgminer.c
  2. 10
      miner.h

8
cgminer.c

@ -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

@ -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…
Cancel
Save