diff options
| author | 2023-11-25 16:24:10 +0000 | |
|---|---|---|
| committer | 2026-11-07 02:12:00 +0000 | |
| commit | bca75f071153ddcaa5ceee0722e2152bacfedc78 (patch) | |
| tree | 7c42e4aa83103aa9813151e4251d2ffb4023ffbe /src/utils.h | |
| download | lab-01-master.tar.gz | |
Diffstat (limited to 'src/utils.h')
| -rw-r--r-- | src/utils.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h new file mode 100644 index 0000000..99765db --- /dev/null +++ b/src/utils.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #ifndef UTILS_H | ||
| 2 | #define UTILS_H | ||
| 3 | |||
| 4 | #define MAX(a, b) ({ \ | ||
| 5 | __typeof__ (a) _a = (a); \ | ||
| 6 | __typeof__ (b) _b = (b); \ | ||
| 7 | _a > _b ? _a : _b; \ | ||
| 8 | }) | ||
| 9 | |||
| 10 | #define MIN(a, b) ({ \ | ||
| 11 | __typeof__ (a) _a = (a); \ | ||
| 12 | __typeof__ (b) _b = (b); \ | ||
| 13 | _a < _b ? _a : _b; \ | ||
| 14 | }) | ||
| 15 | |||
| 16 | #define CTZ(X) __builtin_ctz (X) | ||
| 17 | |||
| 18 | #define PAGEBREAK() puts ("\n") | ||
| 19 | #define NEWLINE() putchar ('\n'); | ||
| 20 | |||
| 21 | typedef unsigned int uint; | ||
| 22 | |||
| 23 | int | ||
| 24 | input (const char *message, const char *regex, const char *template, ...); | ||
| 25 | |||
| 26 | uint | ||
| 27 | log10ui (uint ui); | ||
| 28 | |||
| 29 | #endif | ||
