1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-03-09 12:11:02 +00:00

Make the avalon array size a macro.

This commit is contained in:
Con Kolivas 2013-04-08 15:36:18 +10:00
parent 8a90b5dd10
commit 0c35f67aa9
2 changed files with 4 additions and 2 deletions

View File

@ -670,7 +670,8 @@ static bool avalon_prepare(struct thr_info *thr)
struct timeval now;
free(avalon->works);
avalon->works = calloc(info->miner_count * sizeof(struct work *), 4);
avalon->works = calloc(info->miner_count * sizeof(struct work *),
AVALON_ARRAY_SIZE);
if (!avalon->works)
quit(1, "Failed to calloc avalon works in avalon_prepare");
if (avalon->device_fd == -1)
@ -797,7 +798,7 @@ static bool avalon_fill(struct cgpu_info *avalon)
static void avalon_rotate_array(struct cgpu_info *avalon)
{
avalon->queued = 0;
if (++avalon->work_array > 3)
if (++avalon->work_array >= AVALON_ARRAY_SIZE)
avalon->work_array = 0;
}

View File

@ -99,6 +99,7 @@ struct avalon_info {
#define AVALON_WRITE_SIZE (sizeof(struct avalon_task))
#define AVALON_READ_SIZE (sizeof(struct avalon_result))
#define AVALON_ARRAY_SIZE 4
#define AVA_GETS_ERROR -1
#define AVA_GETS_OK 0