Browse Source

Provide a function for setting the work ntime.

nfactor-troky
Con Kolivas 11 years ago committed by Noel Maersk
parent
commit
9ed6c3b1b5
  1. 11
      cgminer.c
  2. 1
      miner.h

11
cgminer.c

@ -3350,6 +3350,17 @@ static void _copy_work(struct work *work, const struct work *base_work, int noff @@ -3350,6 +3350,17 @@ static void _copy_work(struct work *work, const struct work *base_work, int noff
work->coinbase = strdup(base_work->coinbase);
}
void set_work_ntime(struct work *work, int ntime)
{
uint32_t *work_ntime = (uint32_t *)(work->data + 68);
*work_ntime = htobe32(ntime);
if (work->ntime) {
free(work->ntime);
work->ntime = bin2hex((unsigned char *)work_ntime, 4);
}
}
/* Generates a copy of an existing work struct, creating fresh heap allocations
* for all dynamically allocated arrays within the struct. noffset is used for
* when a driver has internally rolled the ntime, noffset is a relative value.

1
miner.h

@ -1399,6 +1399,7 @@ extern void adl(void); @@ -1399,6 +1399,7 @@ extern void adl(void);
extern void app_restart(void);
extern void clean_work(struct work *work);
extern void free_work(struct work *work);
extern void set_work_ntime(struct work *work, int ntime);
extern struct work *copy_work_noffset(struct work *base_work, int noffset);
#define copy_work(work_in) copy_work_noffset(work_in, 0)
extern struct thr_info *get_thread(int thr_id);

Loading…
Cancel
Save