forked from Jimmy-Z/bfCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
40 lines (22 loc) · 834 Bytes
/
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
#pragma once
// 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);