Browse Source

icarus: Skip unnecessary nonce memcpy

Luke Dashjr 12 years ago
parent
commit
de630da848
1 changed files with 2 additions and 4 deletions
  1. 2 4
      driver-icarus.c

+ 2 - 4
driver-icarus.c

@@ -879,8 +879,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 
 
 	struct ICARUS_INFO *info;
 	struct ICARUS_INFO *info;
 
 
-	unsigned char nonce_bin[ICARUS_READ_SIZE] = {0};
-	uint32_t nonce;
+	uint32_t nonce = 0;
 	int64_t hash_count;
 	int64_t hash_count;
 	struct timeval tv_start, elapsed;
 	struct timeval tv_start, elapsed;
 	struct timeval tv_history_start, tv_history_finish;
 	struct timeval tv_history_start, tv_history_finish;
@@ -918,7 +917,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 		else
 		else
 		{
 		{
 			/* Icarus will return 4 bytes (ICARUS_READ_SIZE) nonces or nothing */
 			/* Icarus will return 4 bytes (ICARUS_READ_SIZE) nonces or nothing */
-			ret = icarus_gets(nonce_bin, fd, &state->tv_workfinish, thr, info->read_count);
+			ret = icarus_gets((void*)&nonce, fd, &state->tv_workfinish, thr, info->read_count);
 			switch (ret) {
 			switch (ret) {
 				case ICA_GETS_RESTART:
 				case ICA_GETS_RESTART:
 					// The prepared work is invalid, and the current work is abandoned
 					// The prepared work is invalid, and the current work is abandoned
@@ -952,7 +951,6 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 	tcflush(fd, TCOFLUSH);
 	tcflush(fd, TCOFLUSH);
 #endif
 #endif
 
 
-	memcpy(&nonce, nonce_bin, sizeof(nonce_bin));
 	nonce = be32toh(nonce);
 	nonce = be32toh(nonce);
 
 
 	// Handle dynamic clocking for "subclass" devices
 	// Handle dynamic clocking for "subclass" devices