summaryrefslogtreecommitdiffstats
path: root/common.h
blob: 1c214a447fd36cb393f08b84317ac23312fc6184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef _COMMON_H
#define _COMMON_H

#define __round_mask(x, y) ((__typeof__(x))((y)-1))
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

#define min(x, y) ((x) > (y) ? (y) : (x))
#define max(x, y) ((x) > (y) ? (x) : (y))

#define __stringify_1(x...) #x
#define __stringify(x...)  __stringify_1(x)

#endif