This commit is contained in:
Jay D Dee
2017-02-04 16:43:40 -05:00
parent b0088fd392
commit 1ee41348f4
6 changed files with 30 additions and 6 deletions

View File

@@ -29,11 +29,18 @@
static __thread uint32_t s_ntime = UINT32_MAX;
static __thread int permutation[HASH_FUNC_COUNT] = { 0 };
inline void tt_swap( int *a, int *b )
{
int c = *a;
*a = *b;
*b = c;
}
inline void reverse( int *pbegin, int *pend )
{
while ( (pbegin != pend) && (pbegin != --pend) )
{
swap_vars( *pbegin, *pend );
tt_swap( pbegin, pend );
pbegin++;
}
}
@@ -62,7 +69,7 @@ static void next_permutation( int *pbegin, int *pend )
while ( !(*i < *--k) ) /* do nothing */ ;
swap_vars( *i, *k );
tt_swap( i, k );
reverse(j, pend);
return; // true
}

View File

@@ -136,20 +136,26 @@ void getAlgoString( char *str, uint32_t count )
//applog(LOG_DEBUG, "nextPerm %s", str);
}
// Broken on Windows
#if !((defined(__WINDOWS__)) || (defined(__WIN64)))
static __thread uint32_t saved_ntime = UINT32_MAX;
#endif
void evocoin_twisted_code( char *result, char *code )
{
uint32_t h32, *be32 = get_stratum_job_ntime();
#if !((defined(__WINDOWS__)) || (defined(__WIN64)))
if ( *be32 != saved_ntime )
{
#endif
h32 = be32toh(*be32);
uint32_t count = getCurrentAlgoSeq(h32, INITIAL_DATE);
getAlgoString(code, count);
sprintf(result, "_%d_%s_", count, code);
#if !((defined(__WINDOWS__)) || (defined(__WIN64)))
saved_ntime = *be32;
}
#endif
}
static inline void x11evo_hash( void *state, const void *input )