Skip to content

Commit

Permalink
small cleanup, reduce warnings with gcc 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Jul 13, 2018
1 parent b57797c commit 41da2b4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
10 changes: 0 additions & 10 deletions algo/allium.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@

#include "miner.h"

static char* format_hash(char* buf, uint8_t *hash)
{
int len = 0;
for (int i=0; i < 32; i += 4) {
len += sprintf(buf+len, "%02x%02x%02x%02x ",
hash[i], hash[i+1], hash[i+2], hash[i+3]);
}
return buf;
}

void allium_hash(void *state, const void *input)
{
uint32_t hashA[8], hashB[8];
Expand Down
10 changes: 0 additions & 10 deletions algo/phi1612.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@

#include "miner.h"

static char* format_hash(char* buf, uint8_t *hash)
{
int len = 0;
for (int i=0; i < 32; i += 4) {
len += sprintf(buf+len, "%02x%02x%02x%02x ",
hash[i], hash[i+1], hash[i+2], hash[i+3]);
}
return buf;
}

void phi1612_hash(void *state, const void *input)
{
sph_skein512_context ctx_skein;
Expand Down
21 changes: 12 additions & 9 deletions algo/sia.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@

#include <crypto/blake2b.h>

#define A 64

#ifdef MIDSTATE
static __thread blake2b_ctx s_midstate;
static __thread blake2b_ctx s_ctx;
#define MIDLEN 76
#define A 64

static void blake2b_hash_end(uint32_t *output, const uint32_t *input)
{
s_ctx.outlen = MIDLEN;
memcpy(&s_ctx, &s_midstate, 32 + 16 + MIDLEN);
blake2b_update(&s_ctx, (uint8_t*) &input[MIDLEN/4], 80 - MIDLEN);
blake2b_final(&s_ctx, (uint8_t*) output);
}
#endif

void blake2b_hash(void *output, const void *input)
{
Expand All @@ -27,14 +38,6 @@ void blake2b_hash(void *output, const void *input)
memcpy(output, hash, 32);
}

static void blake2b_hash_end(uint32_t *output, const uint32_t *input)
{
s_ctx.outlen = MIDLEN;
memcpy(&s_ctx, &s_midstate, 32 + 16 + MIDLEN);
blake2b_update(&s_ctx, (uint8_t*) &input[MIDLEN/4], 80 - MIDLEN);
blake2b_final(&s_ctx, (uint8_t*) output);
}

int scanhash_blake2b(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done)
{
uint32_t _ALIGN(A) vhashcpu[8];
Expand Down
3 changes: 1 addition & 2 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ static int opt_fail_pause = 10;
static int opt_time_limit = 0;
int opt_timeout = 300;
static int opt_scantime = 5;
static const bool opt_time = true;
static enum algos opt_algo = ALGO_SCRYPT;
static int opt_scrypt_n = 1024;
static int opt_pluck_n = 128;
Expand Down Expand Up @@ -668,7 +667,7 @@ static bool work_decode(const json_t *val, struct work *work)
} else if (opt_algo == ALGO_PHI2) {
if (work->data[0] & (1<<30)) use_roots = true;
else for (i = 20; i < 36; i++) {
if (work->data[i]) use_roots = true; break;
if (work->data[i]) { use_roots = true; break; }
}
}

Expand Down

0 comments on commit 41da2b4

Please sign in to comment.