summaryrefslogtreecommitdiffstats
path: root/common.h
blob: aed2a9918b2356b502e168b68de442c792bf1460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#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))

#endif