forked from hyc/wolf-xmr-miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minerutils.h
45 lines (31 loc) · 1.04 KB
/
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
40
41
42
43
44
45
#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 * rawstr, const char * asciistr, size_t len);
void BinaryToASCIIHex(char * asciistr, const void * 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);
void sleep(uint32_t ms);
bool atomic_load(bool *ptr);
void atomic_store(bool *ptr, bool val);
int32_t strcasecmp( char *s1, char *v2);
extern uint32_t BSWAP32(uint32_t x);
#endif