mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 14:58:01 +00:00
algorithm: initial set_algorithm() and set_algorithm_nfactor().
This commit is contained in:
parent
776eec2e11
commit
50a792f2cd
18
algorithm.c
18
algorithm.c
@ -10,8 +10,24 @@
|
||||
#include "algorithm.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct algorithm_t {
|
||||
char name[32]; /* Human-readable identifier */
|
||||
char name[20]; /* Human-readable identifier */
|
||||
uint8_t nfactor; /* N factor (CPU/Memory tradeoff parameter) */
|
||||
} algorithm_t;
|
||||
|
||||
void set_algorithm(algorithm_t* algo, char* newname) {
|
||||
strncpy(algo->name, newname, sizeof(algo->name));
|
||||
algo->name[sizeof(algo->name) - 1] = '\0';
|
||||
|
||||
if (strcmp(algo->name, "adaptive-nfactor") == 0) {
|
||||
algo->nfactor = 11;
|
||||
} else {
|
||||
algo->nfactor = 10;
|
||||
}
|
||||
}
|
||||
|
||||
void set_algorithm_nfactor(algorithm_t* algo, uint8_t nfactor) {
|
||||
algo->nfactor = nfactor;
|
||||
}
|
||||
|
@ -1,10 +1,17 @@
|
||||
#ifndef ALGORITHM_H
|
||||
#define ALGORITHM_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/* Describes the Scrypt parameters and hashing functions used to mine
|
||||
* a specific coin.
|
||||
*/
|
||||
typedef struct algorithm_t algorithm_t;
|
||||
|
||||
/* Set default parameters based on name. */
|
||||
void set_algorithm(algorithm_t* algo, char* name);
|
||||
|
||||
/* Set to specific N factor. */
|
||||
void set_algorithm_nfactor(algorithm_t* algo, uint8_t nfactor);
|
||||
|
||||
#endif /* ALGORITHM_H */
|
||||
|
Loading…
Reference in New Issue
Block a user