mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
add minor optimization for target_to_hex
This commit is contained in:
parent
0be08eddfc
commit
5f253f4827
1 changed files with 8 additions and 4 deletions
12
src/pool.c
12
src/pool.c
|
@ -978,12 +978,16 @@ target_to_hex(uint64_t target, char *target_hex)
|
|||
{
|
||||
memset(target_hex, '0', 8);
|
||||
BIGNUM *res = BN_new();
|
||||
BIGNUM *bnt = NULL;
|
||||
char st[96];
|
||||
snprintf(st, 96, "%"PRIu64, target);
|
||||
BIGNUM *bnt = BN_new();
|
||||
#ifdef SIXTY_FOUR_BIT_LONG
|
||||
BN_set_word(bnt, target);
|
||||
#else
|
||||
char st[24];
|
||||
snprintf(st, 24, "%"PRIu64, target);
|
||||
BN_dec2bn(&bnt, st);
|
||||
#endif
|
||||
BN_div(res, NULL, base_diff, bnt, bn_ctx);
|
||||
unsigned char bnb[64];
|
||||
unsigned char bnb[32];
|
||||
BN_bn2bin(res, &bnb[0]);
|
||||
size_t cc = 4 - (32 - BN_num_bytes(res));
|
||||
|
||||
|
|
Loading…
Reference in a new issue