forked from Gingeropolous/wolf-xmr-miner
-
Notifications
You must be signed in to change notification settings - Fork 3
/
minerutils.h
39 lines (26 loc) · 917 Bytes
/
minerutils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __MINERUTILS_H
#define __MINERUTILS_H
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
// Endian swapping routines
uint32_t BSWAP32(uint32_t data);
void SwapBuffer32(void *data, int chunks);
// ASCII <-> binary conversion routines
int ASCIIHexToBinary(void *restrict rawstr, const char *restrict asciistr, size_t len);
void BinaryToASCIIHex(char *restrict asciistr, const void *restrict rawstr, size_t len);
// File reading routine
size_t LoadTextFile(char **Output, char *Filename);
// Difficulty conversion & validity testing routines
void CreateTargetFromDiff(uint32_t *FullTarget, double Diff);
bool FullTest(const uint32_t *Hash, const uint32_t *FullTarget);
// Time routines
#ifdef __linux__
#define TIME_TYPE struct timespec
#else
#define TIME_TYPE clock_t
#endif
TIME_TYPE MinerGetCurTime(void);
double SecondsElapsed(TIME_TYPE Start, TIME_TYPE End);
#endif