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
|
#ifndef UTILS_H
#define UTILS_H
#include <stdint.h>
#include <stdio.h>
#define MAX(a, b) ({ \
typeof (a) _a = (a); \
typeof (b) _b = (b); \
_a > _b ? _a : _b; \
})
#define MIN(a, b) ({ \
typeof (a) _a = (a); \
typeof (b) _b = (b); \
_a < _b ? _a : _b; \
})
#define SWAP(a, b) ({ \
typeof (a) tmp = (a); \
(a) = (b); \
(b) = tmp; \
})
#define CLZ(X) __builtin_clz (X)
#define CTZ(X) __builtin_ctz (X)
#define POPCOUNT(X) __builtin_popcount (X)
#define NEWLINE() putchar ('\n')
#define PAGEBREAK() putchar ('\n');
#define SUCCESS(MSG, ...) fprintf (stdout, "[+] SUCCESS: "MSG"\n", ##__VA_ARGS__)
#define INFO(MSG, ...) fprintf (stdout, "[*] INFO: " MSG"\n", ##__VA_ARGS__)
#define ERROR(MSG, ...) fprintf (stderr, "[-] ERROR: " MSG"\n", ##__VA_ARGS__)
#define DIE(EXIT_CODE, MSG, ...) ({ ERROR (MSG, ##__VA_ARGS__); exit (EXIT_CODE); })
typedef unsigned int uint;
typedef uint8_t u8;
typedef int8_t s8;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint64_t u64;
int input (const char *message, const char *regex, const char *template, ...);
uint log10ui (uint ui);
#endif
|