mirror of
https://github.com/JayDDee/cpuminer-opt.git
synced 2025-09-17 23:44:27 +00:00
v3.12.8
This commit is contained in:
BIN
.RELEASE_NOTES.swp
Normal file
BIN
.RELEASE_NOTES.swp
Normal file
Binary file not shown.
@@ -65,6 +65,16 @@ If not what makes it happen or not happen?
|
||||
Change Log
|
||||
----------
|
||||
|
||||
v3.12.8
|
||||
|
||||
Yespower sha256 prehash made thread safe.
|
||||
|
||||
Rewrote diff conversion functions from scratch to be simpler and use
|
||||
long double (float80) and int128 arithmetic for improved accuracy and
|
||||
precision.
|
||||
|
||||
Some code cleanup and assorted small changes.
|
||||
|
||||
v3.12.7
|
||||
|
||||
Issue #257: fixed a file descriptor leak which caused the CPU temperature
|
||||
|
@@ -102,23 +102,16 @@ int null_hash()
|
||||
applog(LOG_WARNING,"SWERR: null_hash unsafe null function");
|
||||
return 0;
|
||||
};
|
||||
/*
|
||||
void null_hash_suw()
|
||||
{
|
||||
applog(LOG_WARNING,"SWERR: null_hash_suw unsafe null function");
|
||||
};
|
||||
*/
|
||||
|
||||
void init_algo_gate( algo_gate_t* gate )
|
||||
{
|
||||
gate->miner_thread_init = (void*)&return_true;
|
||||
gate->scanhash = (void*)&null_scanhash;
|
||||
gate->hash = (void*)&null_hash;
|
||||
// gate->hash_suw = (void*)&null_hash_suw;
|
||||
gate->get_new_work = (void*)&std_get_new_work;
|
||||
gate->work_decode = (void*)&std_le_work_decode;
|
||||
gate->decode_extra_data = (void*)&do_nothing;
|
||||
gate->gen_merkle_root = (void*)&sha256d_gen_merkle_root;
|
||||
gate->stratum_gen_work = (void*)&std_stratum_gen_work;
|
||||
gate->build_stratum_request = (void*)&std_le_build_stratum_request;
|
||||
gate->malloc_txs_request = (void*)&std_malloc_txs_request;
|
||||
gate->submit_getwork_result = (void*)&std_le_submit_getwork_result;
|
||||
|
@@ -75,7 +75,7 @@
|
||||
|
||||
// my hack at creating a set data type using bit masks. Set inclusion,
|
||||
// exclusion union and intersection operations are provided for convenience. In // some cases it may be desireable to use boolean algebra directly on the
|
||||
// data to perfomr set operations. Sets can be represented as single
|
||||
// data to perform set operations. Sets can be represented as single
|
||||
// elements, a bitwise OR of multiple elements, a bitwise OR of multiple
|
||||
// set variables or constants, or combinations of the above.
|
||||
// Examples:
|
||||
@@ -110,13 +110,11 @@ inline bool set_excl ( set_t a, set_t b ) { return (a & b) == 0; }
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// mandatory functions, must be overwritten
|
||||
// mandatory function, must be overwritten
|
||||
int ( *scanhash ) ( struct work*, uint32_t, uint64_t*, struct thr_info* );
|
||||
|
||||
// not used anywhere
|
||||
// optional unsafe, must be overwritten if algo uses function
|
||||
// Deprecated, will be removed
|
||||
int ( *hash ) ( void*, const void*, uint32_t ) ;
|
||||
//void ( *hash_suw ) ( void*, const void* );
|
||||
|
||||
//optional, safe to use default in most cases
|
||||
|
||||
@@ -124,9 +122,6 @@ int ( *hash ) ( void*, const void*, uint32_t ) ;
|
||||
// threads.
|
||||
bool ( *miner_thread_init ) ( int );
|
||||
|
||||
// Generate global blockheader from stratum data.
|
||||
void ( *stratum_gen_work ) ( struct stratum_ctx*, struct work* );
|
||||
|
||||
// Get thread local copy of blockheader with unique nonce.
|
||||
void ( *get_new_work ) ( struct work*, struct work*, int, uint32_t* );
|
||||
|
||||
@@ -166,7 +161,9 @@ bool ( *do_this_thread ) ( int );
|
||||
// After do_this_thread
|
||||
void ( *resync_threads ) ( struct work* );
|
||||
|
||||
// No longer needed
|
||||
json_t* (*longpoll_rpc_call) ( CURL*, int*, char* );
|
||||
|
||||
set_t optimizations;
|
||||
int ( *get_work_data_size ) ();
|
||||
int ntime_index;
|
||||
@@ -215,15 +212,12 @@ int null_scanhash();
|
||||
|
||||
// displays warning
|
||||
int null_hash ();
|
||||
//void null_hash_suw();
|
||||
|
||||
// optional safe targets, default listed first unless noted.
|
||||
|
||||
void std_get_new_work( struct work *work, struct work *g_work, int thr_id,
|
||||
uint32_t* end_nonce_ptr );
|
||||
|
||||
void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *work );
|
||||
|
||||
void sha256d_gen_merkle_root( char *merkle_root, struct stratum_ctx *sctx );
|
||||
void SHA256_gen_merkle_root ( char *merkle_root, struct stratum_ctx *sctx );
|
||||
|
||||
@@ -251,10 +245,6 @@ void std_build_block_header( struct work* g_work, uint32_t version,
|
||||
void std_build_extraheader( struct work *work, struct stratum_ctx *sctx );
|
||||
|
||||
json_t* std_longpoll_rpc_call( CURL *curl, int *err, char *lp_url );
|
||||
//json_t* jr2_longpoll_rpc_call( CURL *curl, int *err );
|
||||
|
||||
//bool std_stratum_handle_response( json_t *val );
|
||||
//bool jr2_stratum_handle_response( json_t *val );
|
||||
|
||||
bool std_ready_to_mine( struct work* work, struct stratum_ctx* stratum,
|
||||
int thr_id );
|
||||
@@ -273,11 +263,6 @@ bool register_algo_gate( int algo, algo_gate_t *gate );
|
||||
// compiler warnings but that's just more work for devs adding new algos.
|
||||
bool register_algo( algo_gate_t *gate );
|
||||
|
||||
// Overrides a common set of functions used by RPC2 and other RPC2-specific
|
||||
// init. Called by algo's register function before initializing algo-specific
|
||||
// functions and data.
|
||||
//bool register_json_rpc2( algo_gate_t *gate );
|
||||
|
||||
// use this to call the hash function of an algo directly, ie util.c test.
|
||||
void exec_hash_function( int algo, void *output, const void *pdata );
|
||||
|
||||
|
@@ -48,7 +48,7 @@ int scanhash_blake_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
|
||||
@@ -107,7 +107,7 @@ int scanhash_blake_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( (hash+i)[7] <= HTarget && fulltest( hash+i, ptarget ) )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
|
||||
|
@@ -45,7 +45,7 @@ int scanhash_blake2b_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -100,7 +100,7 @@ int scanhash_blake2b_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -49,7 +49,7 @@ int scanhash_blake2s_16way( struct work *work, uint32_t max_nonce,
|
||||
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 16;
|
||||
@@ -104,7 +104,7 @@ int scanhash_blake2s_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -157,7 +157,7 @@ int scanhash_blake2s_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -49,7 +49,7 @@ int scanhash_blakecoin_4way( struct work *work, uint32_t max_nonce,
|
||||
&& !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
|
||||
@@ -108,7 +108,7 @@ int scanhash_blakecoin_8way( struct work *work, uint32_t max_nonce,
|
||||
&& !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( (n < max_nonce) && !work_restart[thr_id].restart );
|
||||
|
@@ -62,7 +62,7 @@ int scanhash_decred_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[DECRED_NONCE_INDEX] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( (n < max_nonce) && !work_restart[thr_id].restart );
|
||||
|
@@ -105,7 +105,7 @@ int scanhash_pentablake_4way( struct work *work,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
|
||||
|
@@ -46,7 +46,7 @@ int scanhash_bmw512_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -99,7 +99,7 @@ int scanhash_bmw512_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -53,7 +53,7 @@ int scanhash_groestl_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, hash+(lane<<3), mythr, lane );
|
||||
submit_solution( work, hash+(lane<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -143,7 +143,7 @@ int scanhash_myriad_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -226,7 +226,7 @@ int scanhash_myriad_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -129,7 +129,7 @@ int scanhash_jha_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, lane_hash, mythr, i );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -45,7 +45,7 @@ int scanhash_keccak_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -97,7 +97,7 @@ int scanhash_keccak_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ))
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -52,7 +52,7 @@ int scanhash_sha3d_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -111,7 +111,7 @@ int scanhash_sha3d_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -245,7 +245,7 @@ int scanhash_allium_16way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash+(lane<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, hash+(lane<<3), mythr, lane );
|
||||
submit_solution( work, hash+(lane<<3), mythr );
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) );
|
||||
n += 16;
|
||||
@@ -394,7 +394,7 @@ int scanhash_allium_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
|
@@ -76,7 +76,7 @@ int scanhash_lyra2h_4way( struct work *work, uint32_t max_nonce,
|
||||
&& !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( (n < max_nonce-4) && !work_restart[thr_id].restart);
|
||||
|
@@ -200,7 +200,7 @@ int scanhash_lyra2rev2_16way( struct work *work, const uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) );
|
||||
@@ -342,7 +342,7 @@ int scanhash_lyra2rev2_8way( struct work *work, const uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) );
|
||||
@@ -469,7 +469,7 @@ int scanhash_lyra2rev2_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -165,7 +165,7 @@ int scanhash_lyra2rev3_16way( struct work *work, const uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 16;
|
||||
@@ -284,7 +284,7 @@ int scanhash_lyra2rev3_8way( struct work *work, const uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) );
|
||||
@@ -386,7 +386,7 @@ int scanhash_lyra2rev3_4way( struct work *work, const uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm_add_epi32( *noncev, m128_const1_32( 4 ) );
|
||||
|
@@ -124,7 +124,7 @@ int scanhash_lyra2z_16way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) );
|
||||
@@ -222,7 +222,7 @@ int scanhash_lyra2z_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) );
|
||||
@@ -301,7 +301,7 @@ int scanhash_lyra2z_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm_add_epi32( *noncev, m128_const1_32( 4 ) );
|
||||
|
@@ -68,7 +68,7 @@ bool lyra2z330_thread_init()
|
||||
|
||||
bool register_lyra2z330_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->optimizations = SSE42_OPT | AVX2_OPT;
|
||||
gate->optimizations = SSE2_OPT | AVX2_OPT;
|
||||
gate->miner_thread_init = (void*)&lyra2z330_thread_init;
|
||||
gate->scanhash = (void*)&scanhash_lyra2z330;
|
||||
gate->hash = (void*)&lyra2z330_hash;
|
||||
|
@@ -302,7 +302,7 @@ int scanhash_phi2_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
be32enc( pdata + 19, n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -483,7 +483,7 @@ int scanhash_phi2_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
be32enc( pdata + 19, n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
edata[ 19 ] += 4;
|
||||
|
@@ -108,7 +108,7 @@ int scanhash_nist5_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -196,7 +196,7 @@ int scanhash_nist5_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -223,7 +223,7 @@ int scanhash_anime_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -383,7 +383,7 @@ int scanhash_anime_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -596,7 +596,7 @@ int scanhash_hmq1725_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -1018,7 +1018,7 @@ int scanhash_hmq1725_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -235,7 +235,7 @@ int scanhash_quark_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -408,7 +408,7 @@ int scanhash_quark_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -106,13 +106,13 @@ int scanhash_deep_2way( struct work *work,uint32_t max_nonce,
|
||||
if ( fulltest( hash, ptarget) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n;
|
||||
submit_lane_solution( work, hash, mythr, 0 );
|
||||
submit_solution( work, hash, mythr );
|
||||
}
|
||||
if ( !( (hash+8)[7] & mask ) )
|
||||
if ( fulltest( hash+8, ptarget) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+1;
|
||||
submit_lane_solution( work, hash+8, mythr, 1 );
|
||||
submit_solution( work, hash+8, mythr );
|
||||
}
|
||||
n += 2;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -153,7 +153,7 @@ int scanhash_qubit_4way( struct work *work,uint32_t max_nonce,
|
||||
if ( likely( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, hash+(lane<<3), mythr, lane );
|
||||
submit_solution( work, hash+(lane<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce-4 ) && !work_restart[thr_id].restart );
|
||||
@@ -255,13 +255,13 @@ int scanhash_qubit_2way( struct work *work,uint32_t max_nonce,
|
||||
if ( likely( fulltest( hash, ptarget) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n;
|
||||
submit_lane_solution( work, hash, mythr, 0 );
|
||||
submit_solution( work, hash, mythr );
|
||||
}
|
||||
if ( unlikely( ( (hash+8))[7] <= Htarg ) )
|
||||
if ( likely( fulltest( hash+8, ptarget) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n+1;
|
||||
submit_lane_solution( work, hash+8, mythr, 1 );
|
||||
submit_solution( work, hash+8, mythr );
|
||||
}
|
||||
n += 2;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -132,7 +132,7 @@ int scanhash_lbry_16way( struct work *work, uint32_t max_nonce,
|
||||
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[27] = n + i;
|
||||
submit_lane_solution( work, lane_hash, mythr, i );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 16;
|
||||
@@ -251,7 +251,7 @@ int scanhash_lbry_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[27] = n + i;
|
||||
submit_lane_solution( work, lane_hash, mythr, i );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
|
@@ -85,7 +85,7 @@ int scanhash_sha256q_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -173,7 +173,7 @@ int scanhash_sha256q_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -78,7 +78,7 @@ int scanhash_sha256t_8way( struct work *work, const uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -161,7 +161,7 @@ int scanhash_sha256t_4way( struct work *work, const uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -65,7 +65,7 @@ int scanhash_skein_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -162,7 +162,7 @@ int scanhash_skein_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -53,7 +53,7 @@ int scanhash_skein2_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) && !bench )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -115,7 +115,7 @@ int scanhash_skein2_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) && !bench )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -279,7 +279,7 @@ int scanhash_c11_8way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
@@ -459,7 +459,7 @@ int scanhash_c11_4way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -221,7 +221,7 @@ int scanhash_timetravel_4way( struct work *work, uint32_t max_nonce,
|
||||
&& !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !(*restart) );
|
||||
|
@@ -256,7 +256,7 @@ int scanhash_timetravel10_4way( struct work *work,
|
||||
&& !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !(*restart) );
|
||||
|
@@ -128,7 +128,7 @@ int scanhash_tribus_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < max_nonce-8 ) && !work_restart[thr_id].restart);
|
||||
@@ -213,7 +213,7 @@ int scanhash_tribus_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce-4 ) && !work_restart[thr_id].restart);
|
||||
|
@@ -279,7 +279,7 @@ int scanhash_x11_8way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
@@ -469,7 +469,7 @@ int scanhash_x11_4way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -269,7 +269,7 @@ int scanhash_x11evo_4way( struct work* work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -312,7 +312,7 @@ int scanhash_x11gost_8way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
@@ -498,7 +498,7 @@ int scanhash_x11gost_4way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -263,7 +263,7 @@ int scanhash_x12_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -431,7 +431,7 @@ int scanhash_x12_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -208,7 +208,7 @@ int scanhash_phi1612_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < max_nonce-8 ) && !work_restart[thr_id].restart );
|
||||
@@ -344,7 +344,7 @@ int scanhash_phi1612_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -125,7 +125,7 @@ int scanhash_skunk_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash+(i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
m512_const1_64( 0x0000000800000000 ) );
|
||||
@@ -237,7 +237,7 @@ int scanhash_skunk_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash+(i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
m256_const1_64( 0x0000000400000000 ) );
|
||||
|
@@ -319,7 +319,7 @@ int scanhash_x13_8way( struct work *work, uint32_t max_nonce,
|
||||
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
@@ -531,7 +531,7 @@ int scanhash_x13_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -321,7 +321,7 @@ int scanhash_x13bcd_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
@@ -541,7 +541,7 @@ int scanhash_x13bcd_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -246,7 +246,7 @@ int scanhash_x13sm3_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -129,7 +129,7 @@ int scanhash_polytimos_4way( struct work *work, uint32_t max_nonce,
|
||||
if( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
|
||||
|
@@ -108,7 +108,7 @@ int scanhash_veltor_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < max_nonce ) && !(*restart) );
|
||||
|
@@ -324,7 +324,7 @@ int scanhash_x14_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
@@ -534,7 +534,7 @@ int scanhash_x14_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 4;
|
||||
|
@@ -364,7 +364,7 @@ int scanhash_x15_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash, mythr, i );
|
||||
submit_solution( work, hash, mythr );
|
||||
}
|
||||
n += 8;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
@@ -592,7 +592,7 @@ int scanhash_x15_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n+i;
|
||||
submit_lane_solution( work, hash, mythr, i );
|
||||
submit_solution( work, hash, mythr );
|
||||
}
|
||||
n += 4;
|
||||
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
|
||||
|
@@ -505,7 +505,7 @@ int scanhash_x16r_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
m512_const1_64( 0x0000000800000000 ) );
|
||||
@@ -869,7 +869,7 @@ int scanhash_x16r_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
m256_const1_64( 0x0000000400000000 ) );
|
||||
|
@@ -46,7 +46,7 @@ int scanhash_x16rt_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
m512_const1_64( 0x0000000800000000 ) );
|
||||
@@ -99,7 +99,7 @@ int scanhash_x16rt_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
m256_const1_64( 0x0000000400000000 ) );
|
||||
|
@@ -678,7 +678,7 @@ int scanhash_x16rv2_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
m512_const1_64( 0x0000000800000000 ) );
|
||||
@@ -1131,7 +1131,7 @@ int scanhash_x16rv2_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
m256_const1_64( 0x0000000400000000 ) );
|
||||
|
@@ -177,7 +177,7 @@ int scanhash_x21s_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -347,7 +347,7 @@ int scanhash_x21s_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n+i );
|
||||
submit_lane_solution( work, hash+(i<<3), mythr, i );
|
||||
submit_solution( work, hash+(i<<3), mythr );
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
m256_const1_64( 0x0000000400000000 ) );
|
||||
|
@@ -264,7 +264,7 @@ int scanhash_x17_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -432,7 +432,7 @@ int scanhash_x17_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -429,7 +429,7 @@ int scanhash_xevan_8way( struct work *work, uint32_t max_nonce,
|
||||
if ( likely( valid_hash( lane_hash, ptarget ) ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm512_add_epi32( *noncev,
|
||||
@@ -699,7 +699,7 @@ int scanhash_xevan_4way( struct work *work, uint32_t max_nonce,
|
||||
if ( valid_hash( lane_hash, ptarget ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n + lane );
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
*noncev = _mm256_add_epi32( *noncev,
|
||||
|
@@ -493,7 +493,7 @@ int scanhash_x22i_8way( struct work* work, uint32_t max_nonce,
|
||||
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
|
@@ -625,7 +625,7 @@ int scanhash_x25x_8way( struct work* work, uint32_t max_nonce,
|
||||
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
pdata[19] = n + lane;
|
||||
submit_lane_solution( work, lane_hash, mythr, lane );
|
||||
submit_solution( work, lane_hash, mythr );
|
||||
}
|
||||
}
|
||||
n += 8;
|
||||
|
@@ -19,11 +19,12 @@
|
||||
*/
|
||||
|
||||
#include "cpuminer-config.h"
|
||||
#include "miner.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "yescrypt-r8g.h"
|
||||
#include <stdlib.h>
|
||||
#include "algo-gate-api.h"
|
||||
#include "yespower.h"
|
||||
|
||||
int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce,
|
||||
uint64_t *hashes_done, struct thr_info *mythr )
|
||||
@@ -37,6 +38,16 @@ int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce,
|
||||
const uint32_t last_nonce = max_nonce;
|
||||
const int thr_id = mythr->id;
|
||||
|
||||
static __thread int initialized = 0;
|
||||
static __thread yespower_local_t local;
|
||||
|
||||
if ( !initialized )
|
||||
{
|
||||
if ( yespower_init_local( &local ) )
|
||||
return -1;
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
yespower_params_t params =
|
||||
{
|
||||
.version = YESPOWER_0_5,
|
||||
@@ -56,7 +67,7 @@ int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce,
|
||||
SHA256_Update( &sha256_prehash_ctx, endiandata, 64 );
|
||||
|
||||
do {
|
||||
yespower_tls( (unsigned char *)endiandata, params.perslen,
|
||||
yespower_hash( &local, (unsigned char *)endiandata, params.perslen,
|
||||
¶ms, (yespower_binary_t*)hash, thr_id );
|
||||
|
||||
if unlikely( valid_hash( hash, ptarget ) && !opt_benchmark )
|
||||
@@ -76,7 +87,6 @@ bool register_yescryptr8g_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yespower_r8g;
|
||||
gate->hash = (void*)&yespower_tls;
|
||||
pk_buffer_size = 26;
|
||||
opt_sapling = true;
|
||||
opt_target_factor = 65536.0;
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/*-
|
||||
* Copyright 2009 Colin Percival
|
||||
* Copyright 2013-2018 Alexander Peslyak
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file was originally written by Colin Percival as part of the Tarsnap
|
||||
* online backup system.
|
||||
*/
|
||||
#ifndef _YESPOWERR8G_H_
|
||||
#define _YESPOWERR8G_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h> /* for size_t */
|
||||
#include "algo-gate-api.h"
|
||||
#include "algo/yespower/yespower.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int yespowerr8g_tls(const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_YESPOWERR8G_H_ */
|
@@ -1112,10 +1112,10 @@ static void smix(uint8_t *B, size_t r, uint32_t N,
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*/
|
||||
int yespower_b2b(yespower_local_t *local,
|
||||
int yespower_b2b_hash(yespower_local_t *local,
|
||||
const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params,
|
||||
yespower_binary_t *dst, int thrid )
|
||||
void *dst, int thrid )
|
||||
{
|
||||
uint32_t N = params->N;
|
||||
uint32_t r = params->r;
|
||||
@@ -1191,37 +1191,4 @@ fail:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* yespower_tls(src, srclen, params, dst):
|
||||
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
|
||||
* The memory allocation is maintained internally using thread-local storage.
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*/
|
||||
int yespower_b2b_tls(const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst, int thrid )
|
||||
{
|
||||
static __thread int initialized = 0;
|
||||
static __thread yespower_local_t local;
|
||||
|
||||
if (!initialized) {
|
||||
init_region(&local);
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
return yespower_b2b(&local, src, srclen, params, dst, thrid);
|
||||
}
|
||||
/*
|
||||
int yespower_init_local(yespower_local_t *local)
|
||||
{
|
||||
init_region(local);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yespower_free_local(yespower_local_t *local)
|
||||
{
|
||||
return free_region(local);
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
@@ -23,25 +23,17 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file was originally written by Cryply team as part of the Cryply
|
||||
* coin.
|
||||
*/
|
||||
#include "yespower.h"
|
||||
|
||||
#include "algo-gate-api.h"
|
||||
|
||||
yespower_params_t yespower_params;
|
||||
|
||||
SHA256_CTX sha256_prehash_ctx;
|
||||
// Give each thread its own copy to avoid requiring mutex.
|
||||
__thread SHA256_CTX sha256_prehash_ctx;
|
||||
|
||||
// YESPOWER
|
||||
|
||||
int yespower_hash( const char *input, char *output, uint32_t len, int thrid )
|
||||
{
|
||||
return yespower_tls( input, len, &yespower_params,
|
||||
(yespower_binary_t*)output, thrid );
|
||||
}
|
||||
|
||||
int scanhash_yespower( struct work *work, uint32_t max_nonce,
|
||||
uint64_t *hashes_done, struct thr_info *mythr )
|
||||
{
|
||||
@@ -54,6 +46,16 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce,
|
||||
uint32_t n = first_nonce;
|
||||
const int thr_id = mythr->id;
|
||||
|
||||
static __thread int initialized = 0;
|
||||
static __thread yespower_local_t local;
|
||||
|
||||
if ( !initialized )
|
||||
{
|
||||
if ( yespower_init_local( &local ) )
|
||||
return -1;
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
for ( int k = 0; k < 19; k++ )
|
||||
be32enc( &endiandata[k], pdata[k] );
|
||||
endiandata[19] = n;
|
||||
@@ -63,7 +65,8 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce,
|
||||
SHA256_Update( &sha256_prehash_ctx, endiandata, 64 );
|
||||
|
||||
do {
|
||||
if ( yespower_hash( (char*)endiandata, (char*)vhash, 80, thr_id ) )
|
||||
if ( yespower_hash( &local, (char*)endiandata, 80, &yespower_params,
|
||||
(char*)vhash, thr_id ) )
|
||||
if unlikely( valid_hash( vhash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
be32enc( pdata+19, n );
|
||||
@@ -78,11 +81,6 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce,
|
||||
|
||||
// YESPOWER-B2B
|
||||
|
||||
int yespower_b2b_hash( const char *input, char *output, uint32_t len, int thrid )
|
||||
{
|
||||
return yespower_b2b_tls( input, len, &yespower_params, (yespower_binary_t*)output, thrid );
|
||||
}
|
||||
|
||||
int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce,
|
||||
uint64_t *hashes_done, struct thr_info *mythr )
|
||||
{
|
||||
@@ -95,6 +93,16 @@ int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce,
|
||||
const uint32_t last_nonce = max_nonce;
|
||||
const int thr_id = mythr->id;
|
||||
|
||||
static __thread int initialized = 0;
|
||||
static __thread yespower_local_t local;
|
||||
|
||||
if ( !initialized )
|
||||
{
|
||||
if ( yespower_init_local( &local ) )
|
||||
return -1;
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
for ( int k = 0; k < 19; k++ )
|
||||
be32enc( &endiandata[k], pdata[k] );
|
||||
endiandata[19] = n;
|
||||
@@ -104,7 +112,8 @@ int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce,
|
||||
SHA256_Update( &sha256_prehash_ctx, endiandata, 64 );
|
||||
|
||||
do {
|
||||
if (yespower_b2b_hash( (char*) endiandata, (char*) vhash, 80, thr_id ) )
|
||||
if (yespower_b2b_hash( &local, (char*) endiandata, 80, &yespower_params,
|
||||
(char*) vhash, thr_id ) )
|
||||
if unlikely( valid_hash( vhash, ptarget ) && !opt_benchmark )
|
||||
{
|
||||
be32enc( pdata+19, n );
|
||||
@@ -145,7 +154,6 @@ bool register_yespower_algo( algo_gate_t* gate )
|
||||
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yespower;
|
||||
gate->hash = (void*)&yespower_hash;
|
||||
opt_target_factor = 65536.0;
|
||||
return true;
|
||||
};
|
||||
@@ -159,7 +167,6 @@ bool register_yespowerr16_algo( algo_gate_t* gate )
|
||||
yespower_params.perslen = 0;
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yespower;
|
||||
gate->hash = (void*)&yespower_hash;
|
||||
opt_target_factor = 65536.0;
|
||||
return true;
|
||||
};
|
||||
@@ -268,9 +275,8 @@ bool register_power2b_algo( algo_gate_t* gate )
|
||||
applog( LOG_NOTICE,"Key= \"%s\"", yespower_params.pers );
|
||||
applog( LOG_NOTICE,"Key length= %d\n", yespower_params.perslen );
|
||||
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yespower_b2b;
|
||||
gate->hash = (void*)&yespower_b2b_hash;
|
||||
opt_target_factor = 65536.0;
|
||||
return true;
|
||||
};
|
||||
@@ -310,7 +316,6 @@ bool register_yespower_b2b_algo( algo_gate_t* gate )
|
||||
|
||||
gate->optimizations = SSE2_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yespower_b2b;
|
||||
gate->hash = (void*)&yespower_b2b_hash;
|
||||
opt_target_factor = 65536.0;
|
||||
return true;
|
||||
};
|
||||
|
@@ -1024,10 +1024,10 @@ static void smix(uint8_t *B, size_t r, uint32_t N,
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*/
|
||||
int yespower(yespower_local_t *local,
|
||||
int yespower_hash( yespower_local_t *local,
|
||||
const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params,
|
||||
yespower_binary_t *dst, int thrid )
|
||||
void *dst, int thrid )
|
||||
{
|
||||
yespower_version_t version = params->version;
|
||||
uint32_t N = params->N;
|
||||
@@ -1158,27 +1158,6 @@ int yespower(yespower_local_t *local,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* yespower_tls(src, srclen, params, dst):
|
||||
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
|
||||
* The memory allocation is maintained internally using thread-local storage.
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*/
|
||||
int yespower_tls(const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst, int thrid )
|
||||
{
|
||||
static __thread int initialized = 0;
|
||||
static __thread yespower_local_t local;
|
||||
|
||||
if (!initialized) {
|
||||
if (yespower_init_local(&local))
|
||||
return -1;
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
return yespower( &local, src, srclen, params, dst, thrid );
|
||||
}
|
||||
|
||||
int yespower_init_local(yespower_local_t *local)
|
||||
{
|
||||
@@ -1190,4 +1169,5 @@ int yespower_free_local(yespower_local_t *local)
|
||||
{
|
||||
return free_region(local);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -76,67 +76,21 @@ typedef struct {
|
||||
unsigned char uc[32];
|
||||
} yespower_binary_t __attribute__ ((aligned (64)));
|
||||
|
||||
yespower_params_t yespower_params;
|
||||
extern yespower_params_t yespower_params;
|
||||
|
||||
SHA256_CTX sha256_prehash_ctx;
|
||||
extern __thread SHA256_CTX sha256_prehash_ctx;
|
||||
|
||||
/**
|
||||
* yespower_init_local(local):
|
||||
* Initialize the thread-local (RAM) data structure. Actual memory allocation
|
||||
* is currently fully postponed until a call to yespower().
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*
|
||||
* MT-safe as long as local is local to the thread.
|
||||
*/
|
||||
extern int yespower_init_local(yespower_local_t *local);
|
||||
|
||||
/**
|
||||
* yespower_free_local(local):
|
||||
* Free memory that may have been allocated for an initialized thread-local
|
||||
* (RAM) data structure.
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*
|
||||
* MT-safe as long as local is local to the thread.
|
||||
*/
|
||||
extern int yespower_free_local(yespower_local_t *local);
|
||||
|
||||
/**
|
||||
* yespower(local, src, srclen, params, dst):
|
||||
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
|
||||
* local is the thread-local data structure, allowing to preserve and reuse a
|
||||
* memory allocation across calls, thereby reducing processing overhead.
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*
|
||||
* local must be initialized with yespower_init_local().
|
||||
*
|
||||
* MT-safe as long as local and dst are local to the thread.
|
||||
*/
|
||||
extern int yespower(yespower_local_t *local,
|
||||
extern int yespower_hash(yespower_local_t *local,
|
||||
const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst, int thrid);
|
||||
const yespower_params_t *params, void *dst, int thrid);
|
||||
|
||||
extern int yespower_b2b(yespower_local_t *local,
|
||||
extern int yespower_b2b_hash(yespower_local_t *local,
|
||||
const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst, int thrid );
|
||||
|
||||
/**
|
||||
* yespower_tls(src, srclen, params, dst):
|
||||
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
|
||||
* The memory allocation is maintained internally using thread-local storage.
|
||||
*
|
||||
* Return 0 on success; or -1 on error.
|
||||
*
|
||||
* MT-safe as long as dst is local to the thread.
|
||||
*/
|
||||
extern int yespower_tls(const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst, int thr_id);
|
||||
|
||||
extern int yespower_b2b_tls(const uint8_t *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_binary_t *dst, int thr_id);
|
||||
|
||||
const yespower_params_t *params, void *dst, int thrid );
|
||||
|
||||
#if defined(__AVX2__)
|
||||
|
||||
@@ -149,7 +103,6 @@ extern int yespower_8way( yespower_local_t *local, const __m256i *src,
|
||||
size_t srclen, const yespower_params_t *params,
|
||||
yespower_8way_binary_t *dst, int thrid );
|
||||
|
||||
|
||||
extern int yespower_8way_tls( const __m256i *src, size_t srclen,
|
||||
const yespower_params_t *params, yespower_8way_binary_t *dst, int thr_id );
|
||||
|
||||
|
20
configure
vendored
20
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.7.
|
||||
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.8.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
@@ -577,8 +577,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='cpuminer-opt'
|
||||
PACKAGE_TARNAME='cpuminer-opt'
|
||||
PACKAGE_VERSION='3.12.7'
|
||||
PACKAGE_STRING='cpuminer-opt 3.12.7'
|
||||
PACKAGE_VERSION='3.12.8'
|
||||
PACKAGE_STRING='cpuminer-opt 3.12.8'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures cpuminer-opt 3.12.7 to adapt to many kinds of systems.
|
||||
\`configure' configures cpuminer-opt 3.12.8 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1404,7 +1404,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of cpuminer-opt 3.12.7:";;
|
||||
short | recursive ) echo "Configuration of cpuminer-opt 3.12.8:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1509,7 +1509,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
cpuminer-opt configure 3.12.7
|
||||
cpuminer-opt configure 3.12.8
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@@ -2012,7 +2012,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by cpuminer-opt $as_me 3.12.7, which was
|
||||
It was created by cpuminer-opt $as_me 3.12.8, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2993,7 +2993,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='cpuminer-opt'
|
||||
VERSION='3.12.7'
|
||||
VERSION='3.12.8'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -6690,7 +6690,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by cpuminer-opt $as_me 3.12.7, which was
|
||||
This file was extended by cpuminer-opt $as_me 3.12.8, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -6756,7 +6756,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
cpuminer-opt config.status 3.12.7
|
||||
cpuminer-opt config.status 3.12.8
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
AC_INIT([cpuminer-opt], [3.12.7])
|
||||
AC_INIT([cpuminer-opt], [3.12.8])
|
||||
|
||||
AC_PREREQ([2.59c])
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
317
cpu-miner.c
317
cpu-miner.c
@@ -196,9 +196,8 @@ static uint64_t reject_sum = 0;
|
||||
static uint64_t solved_sum = 0;
|
||||
static double norm_diff_sum = 0.;
|
||||
static uint32_t last_block_height = 0;
|
||||
static double highest_share = 0; // all shares include discard and reject
|
||||
static double lowest_share = 9e99; // lowest accepted
|
||||
//static bool new_job = false;
|
||||
static double highest_share = 0; // highest accepted share diff
|
||||
static double lowest_share = 9e99; // lowest accepted share diff
|
||||
static double last_targetdiff = 0.;
|
||||
#if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32))
|
||||
static uint32_t hi_temp = 0;
|
||||
@@ -212,7 +211,6 @@ static char const short_options[] =
|
||||
"a:b:Bc:CDf:hK:m:n:N:p:Px:qr:R:s:t:T:o:u:O:V";
|
||||
|
||||
static struct work g_work __attribute__ ((aligned (64))) = {{ 0 }};
|
||||
//static struct work tmp_work;
|
||||
time_t g_work_time = 0;
|
||||
static pthread_mutex_t g_work_lock;
|
||||
static bool submit_old = false;
|
||||
@@ -453,7 +451,7 @@ static bool work_decode( const json_t *val, struct work *work )
|
||||
return false;
|
||||
if ( !allow_mininginfo )
|
||||
net_diff = algo_gate.calc_network_diff( work );
|
||||
work->targetdiff = target_to_diff( work->target );
|
||||
work->targetdiff = hash_to_diff( work->target );
|
||||
stratum_diff = last_targetdiff = work->targetdiff;
|
||||
work->sharediff = 0;
|
||||
algo_gate.decode_extra_data( work, &net_blocks );
|
||||
@@ -909,9 +907,12 @@ static inline void sprintf_et( char *str, int seconds )
|
||||
sprintf( str, "%um%02us", min, sec );
|
||||
}
|
||||
|
||||
const double exp32 = 4294967296.; // 2**32
|
||||
const double exp48 = 4294967296. * 65536.; // 2**48
|
||||
const double exp64 = 4294967296. * 4294967296.; // 2**64
|
||||
const long double exp32 = EXP32; // 2**32
|
||||
const long double exp48 = EXP32 * EXP16; // 2**48
|
||||
const long double exp64 = EXP32 * EXP32; // 2**64
|
||||
const long double exp96 = EXP32 * EXP32 * EXP32; // 2**96
|
||||
const long double exp128 = EXP32 * EXP32 * EXP32 * EXP32; // 2**128
|
||||
const long double exp160 = EXP32 * EXP32 * EXP32 * EXP32 * EXP16; // 2**160
|
||||
|
||||
struct share_stats_t
|
||||
{
|
||||
@@ -971,7 +972,8 @@ void report_summary_log( bool force )
|
||||
* (double)(accepts) / share_time;
|
||||
double sess_hrate = uptime.tv_sec == 0. ? 0. : exp32 * norm_diff_sum
|
||||
/ (double)uptime.tv_sec;
|
||||
double submit_rate = share_time == 0. ? 0. : (double)submits*60. / share_time;
|
||||
double submit_rate = share_time == 0. ? 0. : (double)submits*60.
|
||||
/ share_time;
|
||||
char shr_units[4] = {0};
|
||||
char ghr_units[4] = {0};
|
||||
char sess_hr_units[4] = {0};
|
||||
@@ -1081,7 +1083,8 @@ static int share_result( int result, struct work *work,
|
||||
if ( likely( result ) )
|
||||
{
|
||||
accepted_share_count++;
|
||||
if ( my_stats.share_diff < lowest_share )
|
||||
if ( ( my_stats.share_diff > 0. )
|
||||
&& ( my_stats.share_diff < lowest_share ) )
|
||||
lowest_share = my_stats.share_diff;
|
||||
if ( my_stats.share_diff > highest_share )
|
||||
highest_share = my_stats.share_diff;
|
||||
@@ -1119,7 +1122,6 @@ static int share_result( int result, struct work *work,
|
||||
rejected_share_count++;
|
||||
sprintf( sres, "S%d", stale_share_count );
|
||||
sprintf( rres, "Rejected %d" , rejected_share_count );
|
||||
// lowdiff_debug = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,19 +1188,17 @@ static int share_result( int result, struct work *work,
|
||||
applog( LOG_WARNING, "Reject reason: %s", reason );
|
||||
|
||||
// display share hash and target for troubleshooting
|
||||
diff_to_target( str, my_stats.share_diff );
|
||||
applog2( LOG_INFO, "Hash: %08x%08x%08x%08x...",
|
||||
str[7], str[6], str[5], str[4] );
|
||||
diff_to_hash( str, my_stats.share_diff );
|
||||
applog2( LOG_INFO, "Hash: %08x%08x%08x...", str[7], str[6], str[5] );
|
||||
uint32_t *targ;
|
||||
if ( work )
|
||||
targ = work->target;
|
||||
else
|
||||
{
|
||||
diff_to_target( str, my_stats.target_diff );
|
||||
diff_to_hash( str, my_stats.target_diff );
|
||||
targ = &str[0];
|
||||
}
|
||||
applog2( LOG_INFO, "Target: %08x%08x%08x%08x...",
|
||||
targ[7], targ[6], targ[5], targ[4] );
|
||||
applog2( LOG_INFO, "Target: %08x%08x%08x...", targ[7], targ[6], targ[5] );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -1312,7 +1312,6 @@ char* std_malloc_txs_request( struct work *work )
|
||||
json_t *val;
|
||||
char data_str[2 * sizeof(work->data) + 1];
|
||||
int i;
|
||||
|
||||
int datasize = work->sapling ? 112 : 80;
|
||||
|
||||
for ( i = 0; i < ARRAY_SIZE(work->data); i++ )
|
||||
@@ -1681,7 +1680,7 @@ static bool get_work(struct thr_info *thr, struct work *work)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool submit_work( struct thr_info *thr, const struct work *work_in )
|
||||
static bool submit_work( struct thr_info *thr, const struct work *work_in )
|
||||
{
|
||||
struct workio_cmd *wc;
|
||||
|
||||
@@ -1705,20 +1704,8 @@ err_out:
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// __float128?
|
||||
// Convert little endian 256 bit (38 decimal digits) unsigned integer to
|
||||
// double precision floating point with 15 decimal digits precision.
|
||||
static inline double u256_to_double( const uint64_t *u )
|
||||
{
|
||||
return ( ( u[3] * exp64 + u[2] ) * exp64 + u[1] ) * exp64 + u[0];
|
||||
}
|
||||
*/
|
||||
|
||||
static void update_submit_stats( struct work *work, const void *hash )
|
||||
{
|
||||
// work->sharediff = hash ? exp32 / ( (uint64_t*)hash )[3] : 0.;
|
||||
|
||||
pthread_mutex_lock( &stats_lock );
|
||||
|
||||
submitted_share_count++;
|
||||
@@ -1738,12 +1725,10 @@ static void update_submit_stats( struct work *work, const void *hash )
|
||||
bool submit_solution( struct work *work, const void *hash,
|
||||
struct thr_info *thr )
|
||||
{
|
||||
work->sharediff = hash ? exp32 / ( (uint64_t*)hash )[3] : 0.;
|
||||
|
||||
work->sharediff = hash_to_diff( hash );
|
||||
if ( likely( submit_work( thr, work ) ) )
|
||||
{
|
||||
update_submit_stats( work, hash );
|
||||
|
||||
if ( !opt_quiet )
|
||||
{
|
||||
if ( have_stratum )
|
||||
@@ -1772,45 +1757,6 @@ bool submit_solution( struct work *work, const void *hash,
|
||||
return false;
|
||||
}
|
||||
|
||||
// deprecated, use submit_solution
|
||||
bool submit_lane_solution( struct work *work, const void *hash,
|
||||
struct thr_info *thr, const int lane )
|
||||
{
|
||||
work->sharediff = hash ? exp32 / ( (uint64_t*)hash )[3] : 0.;
|
||||
|
||||
if ( likely( submit_work( thr, work ) ) )
|
||||
{
|
||||
update_submit_stats( work, hash );
|
||||
|
||||
if ( !opt_quiet )
|
||||
{
|
||||
if ( have_stratum )
|
||||
applog( LOG_NOTICE, "%d Submitted Diff %.5g, Block %d, Job %s",
|
||||
submitted_share_count, work->sharediff, work->height,
|
||||
work->job_id );
|
||||
else
|
||||
applog( LOG_NOTICE, "%d Submitted Diff %.5g, Block %d, Ntime %08x",
|
||||
submitted_share_count, work->sharediff, work->height,
|
||||
work->data[ algo_gate.ntime_index ] );
|
||||
}
|
||||
|
||||
if ( lowdiff_debug )
|
||||
{
|
||||
uint32_t* h = (uint32_t*)hash;
|
||||
uint32_t* t = (uint32_t*)work->target;
|
||||
applog(LOG_INFO,"Hash[7:0]: %08x %08x %08x %08x %08x %08x %08x %08x",
|
||||
h[7],h[6],h[5],h[4],h[3],h[2],h[1],h[0]);
|
||||
applog(LOG_INFO,"Targ[7:0]: %08x %08x %08x %08x %08x %08x %08x %08x",
|
||||
t[7],t[6],t[5],t[4],t[3],t[2],t[1],t[0]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
applog( LOG_WARNING, "%d failed to submit share", submitted_share_count );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool wanna_mine(int thr_id)
|
||||
{
|
||||
bool state = true;
|
||||
@@ -1914,8 +1860,6 @@ void std_get_new_work( struct work* work, struct work* g_work, int thr_id,
|
||||
work_free( work );
|
||||
work_copy( work, g_work );
|
||||
*nonceptr = 0xffffffffU / opt_n_threads * thr_id;
|
||||
// if ( opt_randomize )
|
||||
// *nonceptr += ( (rand() *4 ) & UINT32_MAX ) / opt_n_threads;
|
||||
*end_nonce_ptr = ( 0xffffffffU / opt_n_threads ) * (thr_id+1) - 0x20;
|
||||
}
|
||||
else
|
||||
@@ -1933,6 +1877,108 @@ bool std_ready_to_mine( struct work* work, struct stratum_ctx* stratum,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work )
|
||||
{
|
||||
pthread_mutex_lock( &sctx->work_lock );
|
||||
free( g_work->job_id );
|
||||
g_work->job_id = strdup( sctx->job.job_id );
|
||||
g_work->xnonce2_len = sctx->xnonce2_size;
|
||||
g_work->xnonce2 = (uchar*) realloc( g_work->xnonce2, sctx->xnonce2_size );
|
||||
memcpy( g_work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size );
|
||||
algo_gate.build_extraheader( g_work, sctx );
|
||||
net_diff = algo_gate.calc_network_diff( g_work );
|
||||
algo_gate.set_work_data_endian( g_work );
|
||||
g_work->height = sctx->block_height;
|
||||
g_work->targetdiff = sctx->job.diff
|
||||
/ ( opt_target_factor * opt_diff_factor );
|
||||
diff_to_hash( g_work->target, g_work->targetdiff );
|
||||
|
||||
pthread_mutex_unlock( &sctx->work_lock );
|
||||
|
||||
restart_threads();
|
||||
|
||||
if ( opt_debug )
|
||||
{
|
||||
unsigned char *xnonce2str = abin2hex( g_work->xnonce2,
|
||||
g_work->xnonce2_len );
|
||||
applog( LOG_DEBUG, "DEBUG: job_id='%s' extranonce2=%s ntime=%08x",
|
||||
g_work->job_id, xnonce2str, swab32( g_work->data[17] ) );
|
||||
free( xnonce2str );
|
||||
}
|
||||
|
||||
double hr = 0.;
|
||||
pthread_mutex_lock( &stats_lock );
|
||||
|
||||
for ( int i = 0; i < opt_n_threads; i++ )
|
||||
hr += thr_hashrates[i];
|
||||
global_hashrate = hr;
|
||||
pthread_mutex_unlock( &stats_lock );
|
||||
|
||||
if ( stratum_diff != sctx->job.diff )
|
||||
applog( LOG_BLUE, "New Diff %g, Block %d, Job %s",
|
||||
sctx->job.diff, sctx->block_height, g_work->job_id );
|
||||
else if ( last_block_height != sctx->block_height )
|
||||
applog( LOG_BLUE, "New Block %d, Job %s",
|
||||
sctx->block_height, g_work->job_id );
|
||||
else if ( g_work->job_id )
|
||||
applog( LOG_BLUE,"New Job %s", g_work->job_id );
|
||||
|
||||
// Update data and calculate new estimates.
|
||||
if ( ( stratum_diff != sctx->job.diff )
|
||||
|| ( last_block_height != sctx->block_height ) )
|
||||
{
|
||||
static bool multipool = false;
|
||||
if ( stratum.block_height < last_block_height ) multipool = true;
|
||||
if ( unlikely( !session_first_block ) )
|
||||
session_first_block = stratum.block_height;
|
||||
last_block_height = stratum.block_height;
|
||||
stratum_diff = sctx->job.diff;
|
||||
last_targetdiff = g_work->targetdiff;
|
||||
if ( lowest_share < last_targetdiff )
|
||||
lowest_share = 9e99;
|
||||
|
||||
if ( !opt_quiet )
|
||||
{
|
||||
applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g",
|
||||
net_diff, stratum_diff, g_work->targetdiff );
|
||||
|
||||
if ( likely( hr > 0. ) )
|
||||
{
|
||||
char hr_units[4] = {0};
|
||||
char block_ttf[32];
|
||||
char share_ttf[32];
|
||||
|
||||
sprintf_et( block_ttf, ( net_diff * exp32 ) / hr );
|
||||
sprintf_et( share_ttf, g_work->targetdiff * exp32 / hr );
|
||||
scale_hash_for_display ( &hr, hr_units );
|
||||
applog2( LOG_INFO, "TTF @ %.2f %sh/s: Block %s, Share %s",
|
||||
hr, hr_units, block_ttf, share_ttf );
|
||||
|
||||
if ( !multipool && last_block_height > session_first_block )
|
||||
{
|
||||
struct timeval now, et;
|
||||
gettimeofday( &now, NULL );
|
||||
timeval_subtract( &et, &now, &session_start );
|
||||
uint64_t net_ttf =
|
||||
( last_block_height - session_first_block ) == 0 ? 0
|
||||
: et.tv_sec / ( last_block_height - session_first_block );
|
||||
if ( net_diff && net_ttf )
|
||||
{
|
||||
double net_hr = net_diff * exp32 / net_ttf;
|
||||
// char net_ttf_str[32];
|
||||
char net_hr_units[4] = {0};
|
||||
|
||||
// sprintf_et( net_ttf_str, net_ttf );
|
||||
scale_hash_for_display ( &net_hr, net_hr_units );
|
||||
applog2( LOG_INFO, "Net hash rate (est) %.2f %sh/s",
|
||||
net_hr, net_hr_units );
|
||||
}
|
||||
}
|
||||
} // hr > 0
|
||||
} // !quiet
|
||||
} // new diff/block
|
||||
}
|
||||
|
||||
static void *miner_thread( void *userdata )
|
||||
{
|
||||
struct work work __attribute__ ((aligned (64))) ;
|
||||
@@ -2053,7 +2099,7 @@ static void *miner_thread( void *userdata )
|
||||
pthread_mutex_lock( &g_work_lock );
|
||||
|
||||
if ( *nonceptr >= end_nonce )
|
||||
algo_gate.stratum_gen_work( &stratum, &g_work );
|
||||
stratum_gen_work( &stratum, &g_work );
|
||||
algo_gate.get_new_work( &work, &g_work, thr_id, &end_nonce );
|
||||
pthread_mutex_unlock( &g_work_lock );
|
||||
}
|
||||
@@ -2104,14 +2150,6 @@ static void *miner_thread( void *userdata )
|
||||
else // getwork inline
|
||||
max64 = opt_scantime * thr_hashrates[thr_id];
|
||||
|
||||
/*
|
||||
if ( have_stratum )
|
||||
max64 = LP_SCANTIME;
|
||||
else
|
||||
max64 = g_work_time + ( have_longpoll ? LP_SCANTIME : opt_scantime )
|
||||
- time(NULL);
|
||||
*/
|
||||
|
||||
// time limit
|
||||
if ( unlikely( opt_time_limit && firstwork_time ) )
|
||||
{
|
||||
@@ -2144,7 +2182,6 @@ static void *miner_thread( void *userdata )
|
||||
// Initial value arbitrarilly set to 1000 just to get
|
||||
// a sample hashrate for the next time.
|
||||
uint32_t work_nonce = *nonceptr;
|
||||
// max64 = 60 * thr_hashrates[thr_id];
|
||||
if ( max64 <= 0)
|
||||
max64 = 1000;
|
||||
if ( work_nonce + max64 > end_nonce )
|
||||
@@ -2531,106 +2568,6 @@ void std_build_extraheader( struct work* g_work, struct stratum_ctx* sctx )
|
||||
sctx->job.final_sapling_hash );
|
||||
}
|
||||
|
||||
void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work )
|
||||
{
|
||||
pthread_mutex_lock( &sctx->work_lock );
|
||||
free( g_work->job_id );
|
||||
g_work->job_id = strdup( sctx->job.job_id );
|
||||
g_work->xnonce2_len = sctx->xnonce2_size;
|
||||
g_work->xnonce2 = (uchar*) realloc( g_work->xnonce2, sctx->xnonce2_size );
|
||||
memcpy( g_work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size );
|
||||
algo_gate.build_extraheader( g_work, sctx );
|
||||
net_diff = algo_gate.calc_network_diff( g_work );
|
||||
algo_gate.set_work_data_endian( g_work );
|
||||
g_work->height = sctx->block_height;
|
||||
g_work->targetdiff = sctx->job.diff
|
||||
/ ( opt_target_factor * opt_diff_factor );
|
||||
diff_to_target( g_work->target, g_work->targetdiff );
|
||||
|
||||
pthread_mutex_unlock( &sctx->work_lock );
|
||||
|
||||
restart_threads();
|
||||
|
||||
if ( opt_debug )
|
||||
{
|
||||
unsigned char *xnonce2str = abin2hex( g_work->xnonce2,
|
||||
g_work->xnonce2_len );
|
||||
applog( LOG_DEBUG, "DEBUG: job_id='%s' extranonce2=%s ntime=%08x",
|
||||
g_work->job_id, xnonce2str, swab32( g_work->data[17] ) );
|
||||
free( xnonce2str );
|
||||
}
|
||||
|
||||
double hr = 0.;
|
||||
pthread_mutex_lock( &stats_lock );
|
||||
|
||||
for ( int i = 0; i < opt_n_threads; i++ )
|
||||
hr += thr_hashrates[i];
|
||||
global_hashrate = hr;
|
||||
pthread_mutex_unlock( &stats_lock );
|
||||
|
||||
if ( stratum_diff != sctx->job.diff )
|
||||
applog( LOG_BLUE, "New Diff %g, Block %d, Job %s",
|
||||
sctx->job.diff, sctx->block_height, g_work->job_id );
|
||||
else if ( last_block_height != sctx->block_height )
|
||||
applog( LOG_BLUE, "New Block %d, Job %s",
|
||||
sctx->block_height, g_work->job_id );
|
||||
else if ( g_work->job_id )
|
||||
applog( LOG_BLUE,"New Job %s", g_work->job_id );
|
||||
|
||||
// Update data and calculate new estimates.
|
||||
if ( ( stratum_diff != sctx->job.diff )
|
||||
|| ( last_block_height != sctx->block_height ) )
|
||||
{
|
||||
static bool multipool = false;
|
||||
if ( stratum.block_height < last_block_height ) multipool = true;
|
||||
if ( unlikely( !session_first_block ) )
|
||||
session_first_block = stratum.block_height;
|
||||
last_block_height = stratum.block_height;
|
||||
stratum_diff = sctx->job.diff;
|
||||
last_targetdiff = g_work->targetdiff;
|
||||
|
||||
if ( !opt_quiet )
|
||||
{
|
||||
applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g",
|
||||
net_diff, stratum_diff, g_work->targetdiff );
|
||||
|
||||
if ( likely( hr > 0. ) )
|
||||
{
|
||||
char hr_units[4] = {0};
|
||||
char block_ttf[32];
|
||||
char share_ttf[32];
|
||||
|
||||
sprintf_et( block_ttf, ( net_diff * exp32 ) / hr );
|
||||
sprintf_et( share_ttf, g_work->targetdiff * exp32 / hr );
|
||||
scale_hash_for_display ( &hr, hr_units );
|
||||
applog2( LOG_INFO, "TTF @ %.2f %sh/s: Block %s, Share %s",
|
||||
hr, hr_units, block_ttf, share_ttf );
|
||||
|
||||
if ( !multipool && last_block_height > session_first_block )
|
||||
{
|
||||
struct timeval now, et;
|
||||
gettimeofday( &now, NULL );
|
||||
timeval_subtract( &et, &now, &session_start );
|
||||
uint64_t net_ttf =
|
||||
( last_block_height - session_first_block ) == 0 ? 0
|
||||
: et.tv_sec / ( last_block_height - session_first_block );
|
||||
if ( net_diff && net_ttf )
|
||||
{
|
||||
double net_hr = net_diff * exp32 / net_ttf;
|
||||
// char net_ttf_str[32];
|
||||
char net_hr_units[4] = {0};
|
||||
|
||||
// sprintf_et( net_ttf_str, net_ttf );
|
||||
scale_hash_for_display ( &net_hr, net_hr_units );
|
||||
applog2( LOG_INFO, "Net hash rate (est) %.2f %sh/s",
|
||||
net_hr, net_hr_units );
|
||||
}
|
||||
}
|
||||
} // hr > 0
|
||||
} // !quiet
|
||||
} // new diff/block
|
||||
}
|
||||
|
||||
static void *stratum_thread(void *userdata )
|
||||
{
|
||||
struct thr_info *mythr = (struct thr_info *) userdata;
|
||||
@@ -2692,10 +2629,10 @@ static void *stratum_thread(void *userdata )
|
||||
if ( stratum.job.job_id
|
||||
&& ( !g_work_time || strcmp( stratum.job.job_id, g_work.job_id ) ) )
|
||||
{
|
||||
pthread_mutex_lock(&g_work_lock);
|
||||
algo_gate.stratum_gen_work( &stratum, &g_work );
|
||||
time(&g_work_time);
|
||||
pthread_mutex_unlock(&g_work_lock);
|
||||
pthread_mutex_lock( &g_work_lock );
|
||||
stratum_gen_work( &stratum, &g_work );
|
||||
time( &g_work_time );
|
||||
pthread_mutex_unlock( &g_work_lock );
|
||||
restart_threads();
|
||||
}
|
||||
|
||||
@@ -3564,7 +3501,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Initialize stats times and counters
|
||||
memset( share_stats, 0, 2 * sizeof (struct share_stats_t) );
|
||||
memset( share_stats, 0, s_stats_size * sizeof (struct share_stats_t) );
|
||||
gettimeofday( &last_submit_time, NULL );
|
||||
memcpy( &five_min_start, &last_submit_time, sizeof (struct timeval) );
|
||||
memcpy( &session_start, &last_submit_time, sizeof (struct timeval) );
|
||||
|
44
miner.h
44
miner.h
@@ -322,16 +322,20 @@ int timeval_subtract( struct timeval *result, struct timeval *x,
|
||||
//
|
||||
// diff_to_hash = 2**32 = 0x100000000 = 4294967296 = exp32;
|
||||
|
||||
const double exp32; // 2**32
|
||||
const double exp48; // 2**48
|
||||
const double exp64; // 2**64
|
||||
#define EXP16 65536.
|
||||
#define EXP32 4294967296.
|
||||
const long double exp32; // 2**32
|
||||
const long double exp48; // 2**48
|
||||
const long double exp64; // 2**64
|
||||
const long double exp96; // 2**96
|
||||
const long double exp128; // 2**128
|
||||
const long double exp160; // 2**160
|
||||
|
||||
bool fulltest( const uint32_t *hash, const uint32_t *target );
|
||||
bool valid_hash( const void*, const void* );
|
||||
|
||||
void work_set_target( struct work* work, double diff );
|
||||
double target_to_diff( uint32_t* target );
|
||||
extern void diff_to_target( uint32_t *target, double diff );
|
||||
double hash_to_diff( const void* );
|
||||
extern void diff_to_hash( uint32_t*, const double );
|
||||
|
||||
double hash_target_ratio( uint32_t* hash, uint32_t* target );
|
||||
void work_set_target_ratio( struct work* work, const void *hash );
|
||||
@@ -344,21 +348,12 @@ struct thr_info {
|
||||
struct cpu_info cpu;
|
||||
};
|
||||
|
||||
//struct thr_info *thr_info;
|
||||
|
||||
void test_hash_and_submit( struct work *work, const void *hash,
|
||||
struct thr_info *thr );
|
||||
//int test_hash_and_submit( struct work *work, const void *hash,
|
||||
// struct thr_info *thr );
|
||||
|
||||
bool submit_solution( struct work *work, const void *hash,
|
||||
struct thr_info *thr );
|
||||
|
||||
// deprecated
|
||||
bool submit_lane_solution( struct work *work, const void *hash,
|
||||
struct thr_info *thr, const int lane );
|
||||
|
||||
bool submit_work( struct thr_info *thr, const struct work *work_in );
|
||||
|
||||
|
||||
void get_currentalgo( char* buf, int sz );
|
||||
/*
|
||||
bool has_sha();
|
||||
@@ -541,9 +536,6 @@ enum algos {
|
||||
ALGO_BMW,
|
||||
ALGO_BMW512,
|
||||
ALGO_C11,
|
||||
ALGO_CRYPTOLIGHT,
|
||||
ALGO_CRYPTONIGHT,
|
||||
ALGO_CRYPTONIGHTV7,
|
||||
ALGO_DECRED,
|
||||
ALGO_DEEP,
|
||||
ALGO_DMD_GR,
|
||||
@@ -635,9 +627,6 @@ static const char* const algo_names[] = {
|
||||
"bmw",
|
||||
"bmw512",
|
||||
"c11",
|
||||
"cryptolight",
|
||||
"cryptonight",
|
||||
"cryptonightv7",
|
||||
"decred",
|
||||
"deep",
|
||||
"dmd-gr",
|
||||
@@ -794,9 +783,6 @@ Options:\n\
|
||||
bmw BMW 256\n\
|
||||
bmw512 BMW 512\n\
|
||||
c11 Chaincoin\n\
|
||||
cryptolight Cryptonight-light\n\
|
||||
cryptonight Cryptonote legacy\n\
|
||||
cryptonightv7 variant 7, Monero (XMR)\n\
|
||||
decred Blake256r14dcr\n\
|
||||
deep Deepcoin (DCN)\n\
|
||||
dmd-gr Diamond\n\
|
||||
@@ -812,8 +798,8 @@ Options:\n\
|
||||
lyra2re lyra2\n\
|
||||
lyra2rev2 lyrav2\n\
|
||||
lyra2rev3 lyrav2v3, Vertcoin\n\
|
||||
lyra2z Zcoin (XZC)\n\
|
||||
lyra2z330 Lyra2 330 rows, Zoin (ZOI)\n\
|
||||
lyra2z\n\
|
||||
lyra2z330 Lyra2 330 rows\n\
|
||||
m7m Magi (XMG)\n\
|
||||
myr-gr Myriad-Groestl\n\
|
||||
neoscrypt NeoScrypt(128, 2, 1)\n\
|
||||
@@ -853,7 +839,7 @@ Options:\n\
|
||||
x14 X14\n\
|
||||
x15 X15\n\
|
||||
x16r\n\
|
||||
x16rv2 Ravencoin (RVN)\n\
|
||||
x16rv2\n\
|
||||
x16rt Gincoin (GIN)\n\
|
||||
x16rt-veil Veil (VEIL)\n\
|
||||
x16s\n\
|
||||
|
@@ -273,6 +273,20 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n )
|
||||
#define mm128_ror_1x32( v ) _mm_shuffle_epi32( v, 0x39 )
|
||||
#define mm128_rol_1x32( v ) _mm_shuffle_epi32( v, 0x93 )
|
||||
|
||||
|
||||
//#define mm128_swap_64( v ) _mm_alignr_epi8( v, v, 8 )
|
||||
//#define mm128_ror_1x32( v ) _mm_alignr_epi8( v, v, 4 )
|
||||
//#define mm128_rol_1x32( v ) _mm_alignr_epi8( v, v, 12 )
|
||||
#define mm128_ror_1x16( v ) _mm_alignr_epi8( v, v, 2 )
|
||||
#define mm128_rol_1x16( v ) _mm_alignr_epi8( v, v, 14 )
|
||||
#define mm128_ror_1x8( v ) _mm_alignr_epi8( v, v, 1 )
|
||||
#define mm128_rol_1x8( v ) _mm_alignr_epi8( v, v, 15 )
|
||||
|
||||
#define mm128_ror_x8( v, c ) _mm_alignr_epi8( v, c )
|
||||
#define mm128_rol_x8( v, c ) _mm_alignr_epi8( v, 16-(c) )
|
||||
|
||||
|
||||
/*
|
||||
// Rotate 16 byte (128 bit) vector by c bytes.
|
||||
// Less efficient using shift but more versatile. Use only for odd number
|
||||
// byte rotations. Use shuffle above whenever possible.
|
||||
@@ -312,6 +326,8 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n )
|
||||
_mm_or_si128( _mm_slli_si128( v, 1 ), _mm_srli_si128( v, 15 ) )
|
||||
|
||||
#endif // SSE3 else SSE2
|
||||
*/
|
||||
|
||||
|
||||
// Invert vector: {3,2,1,0} -> {0,1,2,3}
|
||||
#define mm128_invert_32( v ) _mm_shuffle_epi32( v, 0x1b )
|
||||
@@ -331,7 +347,7 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n )
|
||||
//
|
||||
// Rotate elements within lanes.
|
||||
|
||||
#define mm128_swap_64_32( v ) _mm_shuffle_epi32( v, 0xb1 )
|
||||
#define mm128_swap64_32( v ) _mm_shuffle_epi32( v, 0xb1 )
|
||||
|
||||
#define mm128_rol64_8( v, c ) \
|
||||
_mm_or_si128( _mm_slli_epi64( v, ( ( (c)<<3 ) ), \
|
||||
|
@@ -442,16 +442,19 @@ static inline void memcpy_256( __m256i *dst, const __m256i *src, const int n )
|
||||
|
||||
#define mm256_ror128_32( v ) _mm256_shuffle_epi32( v, 0x39 )
|
||||
|
||||
#define mm256_rol128_1x32( v ) _mm256_shuffle_epi32( v, 0x93 )
|
||||
#define mm256_rol128_32( v ) _mm256_shuffle_epi32( v, 0x93 )
|
||||
|
||||
// Rotave each 128 bit lane by c elements.
|
||||
#define mm256_ror128_x8( v, c ) _mm256_alignr_epi8( v, v, c )
|
||||
|
||||
/*
|
||||
// Rotate each 128 bit lane by c elements.
|
||||
#define mm256_ror128_8( v, c ) \
|
||||
_mm256_or_si256( _mm256_bsrli_epi128( v, c ), \
|
||||
_mm256_bslli_epi128( v, 16-(c) ) )
|
||||
#define mm256_rol128_8( v, c ) \
|
||||
_mm256_or_si256( _mm256_bslli_epi128( v, c ), \
|
||||
_mm256_bsrli_epi128( v, 16-(c) ) )
|
||||
|
||||
*/
|
||||
|
||||
// Rotate elements in each 64 bit lane
|
||||
|
||||
|
@@ -511,7 +511,9 @@ static inline void memcpy_512( __m512i *dst, const __m512i *src, const int n )
|
||||
#define mm512_ror128_32( v ) _mm512_shuffle_epi32( v, 0x39 )
|
||||
#define mm512_rol128_32( v ) _mm512_shuffle_epi32( v, 0x93 )
|
||||
|
||||
#define mm512_ror128_x8( v, c ) _mm512_alignr_epi8( v, v, c )
|
||||
|
||||
/*
|
||||
// Rotate 128 bit lanes by c bytes, faster than building that monstrous
|
||||
// constant above.
|
||||
#define mm512_ror128_8( v, c ) \
|
||||
@@ -520,7 +522,7 @@ static inline void memcpy_512( __m512i *dst, const __m512i *src, const int n )
|
||||
#define mm512_rol128_8( v, c ) \
|
||||
_mm512_or_si512( _mm512_bslli_epi128( v, c ), \
|
||||
_mm512_bsrli_epi128( v, 16-(c) ) )
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// Rotate elements within 64 bit lanes.
|
||||
|
171
util.c
171
util.c
@@ -44,7 +44,7 @@
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
#include "miner.h"
|
||||
//#include "miner.h"
|
||||
#include "elist.h"
|
||||
#include "algo-gate-api.h"
|
||||
|
||||
@@ -983,24 +983,7 @@ int timeval_subtract(struct timeval *result, struct timeval *x,
|
||||
return x->tv_sec < y->tv_sec;
|
||||
}
|
||||
|
||||
// deprecated, use test_hash_and_submit
|
||||
// Use this when deinterleaved
|
||||
// do 64 bit test 4 iterations
|
||||
inline bool valid_hash( const void *hash, const void *target )
|
||||
{
|
||||
const uint64_t *h = (const uint64_t*)hash;
|
||||
const uint64_t *t = (const uint64_t*)target;
|
||||
if ( h[3] > t[3] ) return false;
|
||||
if ( h[3] < t[3] ) return true;
|
||||
if ( h[2] > t[2] ) return false;
|
||||
if ( h[2] < t[2] ) return true;
|
||||
if ( h[1] > t[1] ) return false;
|
||||
if ( h[1] < t[1] ) return true;
|
||||
if ( h[0] > t[0] ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// deprecated, use test_hash_and_submit
|
||||
// Deprecated
|
||||
bool fulltest( const uint32_t *hash, const uint32_t *target )
|
||||
{
|
||||
int i;
|
||||
@@ -1041,65 +1024,121 @@ bool fulltest( const uint32_t *hash, const uint32_t *target )
|
||||
return rc;
|
||||
}
|
||||
|
||||
void diff_to_target(uint32_t *target, double diff)
|
||||
// Mathmatically the difficulty is simply the reciprocal of the hash.
|
||||
// Both are real numbers but the hash (target) is represented as a 256 bit
|
||||
// number with the upper 32 bits representing the whole integer part and the
|
||||
// lower 224 bits representing the fractional part:
|
||||
// target[ 255:224 ] = trunc( 1/diff )
|
||||
// target[ 223: 0 ] = frac( 1/diff )
|
||||
//
|
||||
// The 256 bit hash is exact but any floating point representation is not.
|
||||
// Stratum provides the target difficulty as double precision, inexcact, and
|
||||
// which must be converted to a hash target. The converted hash target will
|
||||
// likely be less precise to to inexact input and conversion error.
|
||||
// converted to 256 bit hash which will also be inexact and likelyless
|
||||
// accurate to to error in conversion.
|
||||
// On the other hand getwork provides a 256 bit hash target which is exact.
|
||||
//
|
||||
// How much precision is needed?
|
||||
//
|
||||
// 128 bit types are implemented in software by the compiler using 64 bit
|
||||
// hardware resulting in lower performance and more error than would be
|
||||
// expected with a hardware 128 bit implementtaion.
|
||||
// Float80 exploits the internals of the FP unit which provide a 64 bit
|
||||
// mantissa in an 80 bit register with hardware rounding. When the destination
|
||||
// is double the data is rounded to float64 format. Long double returns all
|
||||
// 80 bits without rounding and including any accumulated computation error.
|
||||
// Float80 does not fit efficiently in memory.
|
||||
//
|
||||
// 256 bit hash: 76
|
||||
// float: 7 (float32, 80 bits with rounding to 32 bits)
|
||||
// double: 15 (float64, 80 bits with rounding to 64 bits)
|
||||
// long double 19 (float80, 80 bits with no rounding)
|
||||
// __float128 33 (128 bits with no rounding)
|
||||
// uint32_t: 9
|
||||
// uint64_t: 19
|
||||
// uint128_t 38
|
||||
//
|
||||
// The concept of significant digits doesn't apply to the 256 bit hash
|
||||
// representation. It's fixed point making leading zeros significant
|
||||
// Leading zeros count in the 256 bit
|
||||
//
|
||||
// Doing calculations with float128 and uint128 increases precision for
|
||||
// target_to_diff, but doesn't help with stratum diff being limited to
|
||||
// double precision. Is the extra precision really worth the extra cost?
|
||||
//
|
||||
// With double the error rate is 1/1e15, or one hash in every Petahash
|
||||
// with a very low difficulty, not a likely sitiation. Higher difficulty
|
||||
// increases the effective precision. Due to the floating nature of the
|
||||
// decimal point leading zeros aren't counted.
|
||||
//
|
||||
// Unfortunately I can't get float128 to work so long double it is.
|
||||
// All calculations will be done using long double then converted to double.
|
||||
// This prevent introducing significant new error while taking advantage
|
||||
// of HW rounding.
|
||||
|
||||
#if defined(GCC_INT128)
|
||||
|
||||
void diff_to_hash( uint32_t *target, const double diff )
|
||||
{
|
||||
uint64_t m;
|
||||
int k;
|
||||
|
||||
for (k = 6; k > 0 && diff > 1.0; k--)
|
||||
diff /= exp32;
|
||||
|
||||
// diff /= 4294967296.0;
|
||||
|
||||
// m = (uint64_t)(4294901760.0 / diff);
|
||||
|
||||
m = (uint64_t)(exp32 / diff);
|
||||
|
||||
if (m == 0 && k == 6)
|
||||
memset(target, 0xff, 32);
|
||||
else {
|
||||
memset(target, 0, 32);
|
||||
target[k] = (uint32_t)m;
|
||||
target[k + 1] = (uint32_t)(m >> 32);
|
||||
}
|
||||
uint128_t *targ = (uint128_t*)target;
|
||||
register long double m = 1. / diff;
|
||||
targ[0] = 0;
|
||||
targ[1] = (uint128_t)( m * exp96 );
|
||||
}
|
||||
|
||||
// deprecated
|
||||
void work_set_target(struct work* work, double diff)
|
||||
double hash_to_diff( const void *target )
|
||||
{
|
||||
diff_to_target( work->target, diff );
|
||||
work->targetdiff = diff;
|
||||
const uint128_t *targ = (const uint128_t*)target;
|
||||
register long double m = ( (long double)targ[1] / exp96 );
|
||||
// + ( (long double)targ[0] / exp160 );
|
||||
return (double)( 1. / m );
|
||||
}
|
||||
|
||||
double target_to_diff( uint32_t* target )
|
||||
inline bool valid_hash( const void *hash, const void *target )
|
||||
{
|
||||
const uint128_t *h = (const uint128_t*)hash;
|
||||
const uint128_t *t = (const uint128_t*)target;
|
||||
if ( h[1] > t[1] ) return false;
|
||||
if ( h[1] < t[1] ) return true;
|
||||
if ( h[0] > t[0] ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void diff_to_hash( uint32_t *target, const double diff )
|
||||
{
|
||||
uint64_t *targ = (uint64_t*)target;
|
||||
// extract 64 bits from target[ 240:176 ]
|
||||
uint64_t m = ( targ[3] << 16 ) | ( targ[2] >> 48 );
|
||||
return m ? (exp48-1.) / (double)m : 0.;
|
||||
register long double m = ( 1. / diff ) * exp32;
|
||||
targ[1] = targ[0] = 0;
|
||||
targ[3] = (uint64_t)m;
|
||||
targ[2] = (uint64_t)( ( m - (long double)targ[3] ) * exp64 );
|
||||
}
|
||||
|
||||
/*
|
||||
double target_to_diff(uint32_t* target)
|
||||
double hash_to_diff( const void *target )
|
||||
{
|
||||
uchar* tgt = (uchar*) target;
|
||||
uint64_t m =
|
||||
(uint64_t)tgt[29] << 56 |
|
||||
(uint64_t)tgt[28] << 48 |
|
||||
(uint64_t)tgt[27] << 40 |
|
||||
(uint64_t)tgt[26] << 32 |
|
||||
(uint64_t)tgt[25] << 24 |
|
||||
(uint64_t)tgt[24] << 16 |
|
||||
(uint64_t)tgt[23] << 8 |
|
||||
(uint64_t)tgt[22] << 0;
|
||||
|
||||
|
||||
if (!m)
|
||||
return 0.;
|
||||
else
|
||||
return (double)0x0000ffff00000000/m;
|
||||
const uint64_t *targ = (const uint64_t*)target;
|
||||
register long double m = ( (long double)targ[3] / exp32 )
|
||||
+ ( (long double)targ[2] / exp96 );
|
||||
return (double)( 1. / m );
|
||||
}
|
||||
*/
|
||||
|
||||
inline bool valid_hash( const void *hash, const void *target )
|
||||
{
|
||||
const uint64_t *h = (const uint64_t*)hash;
|
||||
const uint64_t *t = (const uint64_t*)target;
|
||||
if ( h[3] > t[3] ) return false;
|
||||
if ( h[3] < t[3] ) return true;
|
||||
if ( h[2] > t[2] ) return false;
|
||||
if ( h[2] < t[2] ) return true;
|
||||
if ( h[1] > t[1] ) return false;
|
||||
if ( h[1] < t[1] ) return true;
|
||||
if ( h[0] > t[0] ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define socket_blocks() (WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
|
Reference in New Issue
Block a user