summaryrefslogtreecommitdiff
path: root/src/kernel/util.h
blob: 9b8cb3d65b1a4a32f0d0bab6fb496adaf96ab9fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once
#include <stddef.h>

#define __NUM2STR(x) #x
#define NUM2STR(x)  __NUM2STR(x)

// see https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
#define min(a,b) ({ \
		typeof (a) _a = (a); \
		typeof (b) _b = (b); \
		_a < _b ? _a : _b; })
#define max(a,b) ({ \
		typeof (a) _a = (a); \
		typeof (b) _b = (b); \
		_a > _b ? _a : _b; })