aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
blob: 99765db30484bfe8ce4c7c88a45409c7beeffe68 (plain)
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
#ifndef UTILS_H
#define UTILS_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 CTZ(X) __builtin_ctz (X)

#define PAGEBREAK() puts ("\n")
#define NEWLINE() putchar ('\n');

typedef unsigned int uint;

int
input (const char *message, const char *regex, const char *template, ...);

uint
log10ui (uint ui);

#endif