1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-03-09 20:21:01 +00:00

Move be32enc_vect to miner.h

This commit is contained in:
elbandi 2016-04-01 01:01:26 +02:00
parent 571af9377a
commit 303b27d3ac
26 changed files with 12 additions and 334 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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 */

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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])

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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)
{

12
miner.h
View File

@ -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)