forked from zoogie/bfCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
51 lines (29 loc) · 1.05 KB
/
utils.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
46
47
48
49
50
51
#pragma once
#include <signal.h> // I sure do hope this works on MS VS; for use with signal handling.
#include <stdint.h>
// a crude cross Windows/POSIX high precision timer
#ifdef _WIN32
#include <Windows.h>
typedef LARGE_INTEGER TimeHP;
#define get_hp_time QueryPerformanceCounter
#define LL "I64"
#else
#include <sys/time.h>
typedef struct timeval TimeHP;
void get_hp_time(TimeHP *pt);
#define LL "ll"
#endif
long long hp_time_diff(TimeHP *pt0, TimeHP *pt1);
int hex2bytes(unsigned char *out, unsigned byte_len, const char *in, int critical);
const char * hexdump(const void *a, unsigned l, int space);
char * read_file(const char *file_name, size_t *p_size);
void read_files(unsigned num_files, const char *file_names[], char *ptrs[], size_t sizes[]);
void dump_to_file(const char *file_name, const void *buf, size_t len);
int cpu_has_rdrand();
int rdrand_fill(unsigned long long *p, size_t size);
char * trim(char *in);
uint32_t stop_bfcl;
uint32_t seedminer_mode;
uint32_t reduced_work_size_mode;
void real_sleep(int sleep_sec);
void intHandler();