From 303b27d3ac8b9ecc99579c62768bb156f02aec14 Mon Sep 17 00:00:00 2001 From: elbandi Date: Fri, 1 Apr 2016 01:01:26 +0200 Subject: [PATCH] Move be32enc_vect to miner.h --- algorithm/animecoin.c | 14 -------------- algorithm/bitblock.c | 14 -------------- algorithm/blake256.c | 13 ------------- algorithm/blakecoin.c | 13 ------------- algorithm/credits.c | 9 --------- algorithm/darkcoin.c | 14 -------------- algorithm/fresh.c | 14 -------------- algorithm/fuguecoin.c | 14 -------------- algorithm/groestlcoin.c | 14 -------------- algorithm/inkcoin.c | 13 ------------- algorithm/lyra2re.c | 14 -------------- algorithm/lyra2rev2.c | 14 -------------- algorithm/marucoin.c | 14 -------------- algorithm/myriadcoin-groestl.c | 14 -------------- algorithm/pluck.c | 12 ------------ algorithm/quarkcoin.c | 14 -------------- algorithm/qubitcoin.c | 15 --------------- algorithm/scrypt.c | 13 ------------- algorithm/sifcoin.c | 14 -------------- algorithm/talkcoin.c | 14 -------------- algorithm/twecoin.c | 14 -------------- algorithm/whirlcoin.c | 14 -------------- algorithm/whirlpoolx.c | 14 -------------- algorithm/x14.c | 13 ------------- algorithm/yescrypt.c | 9 --------- miner.h | 12 ++++++++++++ 26 files changed, 12 insertions(+), 334 deletions(-) diff --git a/algorithm/animecoin.c b/algorithm/animecoin.c index 00bbc70a..65687c04 100644 --- a/algorithm/animecoin.c +++ b/algorithm/animecoin.c @@ -38,20 +38,6 @@ #include "sph/sph_jh.h" #include "sph/sph_keccak.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/bitblock.c b/algorithm/bitblock.c index b91675fd..bd3269d1 100644 --- a/algorithm/bitblock.c +++ b/algorithm/bitblock.c @@ -92,20 +92,6 @@ void init_Bhash_contexts() sph_whirlpool_init(&base_contexts.whirlpool1); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/blake256.c b/algorithm/blake256.c index 8d4b6c56..b81b1fba 100644 --- a/algorithm/blake256.c +++ b/algorithm/blake256.c @@ -39,19 +39,6 @@ #include "sph/sph_blake.h" #include "algorithm/blake256.h" -/* -* Encode a length len/4 vector of (uint32_t) into a length len vector of -* (unsigned char) in big-endian form. Assumes len is a multiple of 4. -*/ -static void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - static const uint32_t diff1targ_blake256 = 0x000000ff; void blake256hash(void *state, const void *input) diff --git a/algorithm/blakecoin.c b/algorithm/blakecoin.c index 9e299856..e0949cfd 100644 --- a/algorithm/blakecoin.c +++ b/algorithm/blakecoin.c @@ -39,19 +39,6 @@ #include "sph/sph_blake.h" #include "algorithm/blakecoin.h" -/* -* Encode a length len/4 vector of (uint32_t) into a length len vector of -* (unsigned char) in big-endian form. Assumes len is a multiple of 4. -*/ -static void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - static const uint32_t diff1targ_blake256 = 0x000000ff; void blakecoinhash(void *state, const void *input) diff --git a/algorithm/credits.c b/algorithm/credits.c index c543b611..a0b51329 100644 --- a/algorithm/credits.c +++ b/algorithm/credits.c @@ -52,15 +52,6 @@ void credits_hash(void *state, const void *input) sph_sha256_close(&sha2, hash2); memcpy(state, hash2, 32); - -} -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); } /* Used externally as confirmation of correct OCL code */ diff --git a/algorithm/darkcoin.c b/algorithm/darkcoin.c index 06e202f8..efc55cb4 100644 --- a/algorithm/darkcoin.c +++ b/algorithm/darkcoin.c @@ -80,20 +80,6 @@ static void init_Xhash_contexts() sph_echo512_init(&base_contexts.echo1); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - static void xhash(void *state, const void *input) { init_Xhash_contexts(); diff --git a/algorithm/fresh.c b/algorithm/fresh.c index 321300ad..a5ef6619 100644 --- a/algorithm/fresh.c +++ b/algorithm/fresh.c @@ -61,20 +61,6 @@ void init_freshHash_contexts() sph_echo512_init(&base_contexts.echo2); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/fuguecoin.c b/algorithm/fuguecoin.c index 387cd6cb..5ccdaecc 100644 --- a/algorithm/fuguecoin.c +++ b/algorithm/fuguecoin.c @@ -33,20 +33,6 @@ #include "sph/sph_fugue.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/groestlcoin.c b/algorithm/groestlcoin.c index 41e18689..3bd96e81 100644 --- a/algorithm/groestlcoin.c +++ b/algorithm/groestlcoin.c @@ -37,20 +37,6 @@ #include "sph/sph_groestl.h" #include "sph/sph_sha2.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/inkcoin.c b/algorithm/inkcoin.c index b09b3966..bcb15b74 100644 --- a/algorithm/inkcoin.c +++ b/algorithm/inkcoin.c @@ -77,19 +77,6 @@ static void init_Xhash_contexts() sph_echo512_init(&base_contexts.echo1); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/lyra2re.c b/algorithm/lyra2re.c index 3ad13608..9a403ce9 100644 --- a/algorithm/lyra2re.c +++ b/algorithm/lyra2re.c @@ -38,20 +38,6 @@ #include "sph/sph_keccak.h" #include "lyra2.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - void lyra2rehash(void *state, const void *input) { sph_blake256_context ctx_blake; diff --git a/algorithm/lyra2rev2.c b/algorithm/lyra2rev2.c index 7af069d5..66d3c568 100644 --- a/algorithm/lyra2rev2.c +++ b/algorithm/lyra2rev2.c @@ -40,20 +40,6 @@ #include "sph/sph_cubehash.h" #include "lyra2.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - void lyra2rev2hash(void *state, const void *input) { sph_blake256_context ctx_blake; diff --git a/algorithm/marucoin.c b/algorithm/marucoin.c index 2cdc7de8..92c08bc4 100644 --- a/algorithm/marucoin.c +++ b/algorithm/marucoin.c @@ -86,20 +86,6 @@ void init_Mhash_contexts() sph_fugue512_init(&base_contexts.fugue1); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/myriadcoin-groestl.c b/algorithm/myriadcoin-groestl.c index 3eaa19fb..b0a44689 100644 --- a/algorithm/myriadcoin-groestl.c +++ b/algorithm/myriadcoin-groestl.c @@ -37,20 +37,6 @@ #include "sph/sph_groestl.h" #include "sph/sph_sha2.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/pluck.c b/algorithm/pluck.c index c6e1fe9f..91f2bc6a 100644 --- a/algorithm/pluck.c +++ b/algorithm/pluck.c @@ -187,18 +187,6 @@ void sha256_transform(uint32_t *state, const uint32_t *block, int swap) state[i] += S[i]; } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} #define ROTL(a, b) (((a) << (b)) | ((a) >> (32 - (b)))) //note, this is 64 bytes static inline void xor_salsa8(uint32_t B[16], const uint32_t Bx[16]) diff --git a/algorithm/quarkcoin.c b/algorithm/quarkcoin.c index 8897ff7f..d6cbdb67 100644 --- a/algorithm/quarkcoin.c +++ b/algorithm/quarkcoin.c @@ -38,20 +38,6 @@ #include "sph/sph_jh.h" #include "sph/sph_keccak.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/qubitcoin.c b/algorithm/qubitcoin.c index e644c2c7..efbfa913 100644 --- a/algorithm/qubitcoin.c +++ b/algorithm/qubitcoin.c @@ -62,21 +62,6 @@ void init_Qhash_contexts() sph_echo512_init(&base_contexts.echo1); } - -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/scrypt.c b/algorithm/scrypt.c index 1b1b329f..968cda6d 100644 --- a/algorithm/scrypt.c +++ b/algorithm/scrypt.c @@ -39,19 +39,6 @@ typedef struct SHA256Context { uint32_t buf[16]; } SHA256_CTX; -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - /* Elementary functions used by SHA256 */ #define Ch(x, y, z) ((x & (y ^ z)) ^ z) #define Maj(x, y, z) ((x & (y | z)) | (y & z)) diff --git a/algorithm/sifcoin.c b/algorithm/sifcoin.c index efa4baac..c2c905c9 100644 --- a/algorithm/sifcoin.c +++ b/algorithm/sifcoin.c @@ -38,20 +38,6 @@ #include "sph/sph_jh.h" #include "sph/sph_keccak.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/talkcoin.c b/algorithm/talkcoin.c index e27f526c..c7260a8e 100644 --- a/algorithm/talkcoin.c +++ b/algorithm/talkcoin.c @@ -58,20 +58,6 @@ void init_Nhash_contexts() sph_skein512_init(&base_contexts.skein1); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/twecoin.c b/algorithm/twecoin.c index 67cb0c00..2056e9c2 100644 --- a/algorithm/twecoin.c +++ b/algorithm/twecoin.c @@ -39,20 +39,6 @@ #include "sph/sph_hamsi.h" #include "sph/sph_panama.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/whirlcoin.c b/algorithm/whirlcoin.c index 8e1954c1..211aeaf3 100644 --- a/algorithm/whirlcoin.c +++ b/algorithm/whirlcoin.c @@ -55,20 +55,6 @@ void init_whirlcoin_hash_contexts() sph_whirlpool1_init(&base_contexts.whirlpool4); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/whirlpoolx.c b/algorithm/whirlpoolx.c index c419057a..e12a8251 100644 --- a/algorithm/whirlpoolx.c +++ b/algorithm/whirlpoolx.c @@ -36,20 +36,6 @@ #include "whirlpoolx.h" -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - void whirlpool_compress(uint8_t state[64], const uint8_t block[64]) { const int NUM_ROUNDS = 10; diff --git a/algorithm/x14.c b/algorithm/x14.c index 44c58892..25ca1c20 100644 --- a/algorithm/x14.c +++ b/algorithm/x14.c @@ -88,19 +88,6 @@ void init_X14hash_contexts() sph_shabal512_init(&base_contexts.shabal1); } -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static inline void be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - - #ifdef __APPLE_CC__ static #endif diff --git a/algorithm/yescrypt.c b/algorithm/yescrypt.c index de00d0f3..31e0c623 100644 --- a/algorithm/yescrypt.c +++ b/algorithm/yescrypt.c @@ -35,15 +35,6 @@ static const uint32_t diff1targ = 0x0000ffff; -static inline void -be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) -{ - uint32_t i; - - for (i = 0; i < len; i++) - dst[i] = htobe32(src[i]); -} - /* Used externally as confirmation of correct OCL code */ int yescrypt_test(unsigned char *pdata, const unsigned char *ptarget, uint32_t nonce) { diff --git a/miner.h b/miner.h index ecaa6a13..00ebbd78 100644 --- a/miner.h +++ b/miner.h @@ -743,6 +743,18 @@ static inline void flip168(void *dest_p, const void *src_p) dest[i] = swab32(src[i]); } +/* + * Encode a length len/4 vector of (uint32_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 4. + */ +static inline void +be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) +{ + uint32_t i; + + for (i = 0; i < len; i++) + dst[i] = htobe32(src[i]); +} /* For flipping to the correct endianness if necessary */ #if defined(__BIG_ENDIAN__) || defined(MIPSEB)