-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.h
29 lines (21 loc) · 904 Bytes
/
misc.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
#ifndef MISC_H
#define MISC_H
#include <stdint.h>
#include <time.h>
#include <sys/time.h>
//-------------------------------------------------------------
#ifndef likely
#define likely(x) __builtin_expect(!!(x), 1) // gcc branch extensions
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
//-------------------------------------------------------------
void timer_set(struct timespec* const t, const int32_t ms_forw);
int32_t _timer_remaining(const struct timespec* const t);
int32_t timer_remaining(const struct timespec* const t);
short timer_timeout(const struct timespec* const t);
void timer_cancel(struct timespec* const t);
int64_t diffntime(struct timespec *t1, struct timespec *t2);
int update_current_time(void);
void maxSleep(const int ms);
int grep(const char *haystack, const char *regExpr, const char **matchedBegin, const char **matchedEnd);
#endif // MISC_H