2018-01-22 23:50:08 +08:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
2019-09-30 04:36:56 +08:00
|
|
|
#include "config.h"
|
2021-01-09 02:18:02 +08:00
|
|
|
#include "compat.h"
|
2019-09-30 04:36:56 +08:00
|
|
|
|
2018-03-25 21:23:00 +08:00
|
|
|
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
|
2018-01-22 23:50:08 +08:00
|
|
|
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
|
|
|
|
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
|
|
|
|
|
2021-04-11 21:01:05 +08:00
|
|
|
#define container_of(ptr, type, member) \
|
|
|
|
((type *) (((char *) (ptr)) - offsetof(type, member)))
|
|
|
|
|
2018-01-22 23:50:08 +08:00
|
|
|
#endif
|