From b9c3804bd95fa4adf48dd177743ccedf6f35b321 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 26 Aug 2018 09:57:14 +0200 Subject: Adding upstream version 0.3. Signed-off-by: Daniel Baumann --- linux_mm.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 linux_mm.h (limited to 'linux_mm.h') diff --git a/linux_mm.h b/linux_mm.h new file mode 100644 index 0000000..d3b3954 --- /dev/null +++ b/linux_mm.h @@ -0,0 +1,36 @@ +#ifndef DECOMPR_MM_H +#define DECOMPR_MM_H + +#define large_malloc(a) malloc(a) +#define large_free(a) free(a) + +#define INIT +#define STATIC + +#define _FILE_OFFSET_BITS 64 + +#include +#include +#include +#include +#include + +/* + * min()/max() macros that also do strict type-checking.. See the + * "unnecessary" pointer comparison. + */ +#define min(x, y) ({ \ + __typeof__(x) _min1 = (x); \ + __typeof__(y) _min2 = (y); \ + (void) (&_min1 == &_min2); \ + _min1 < _min2 ? _min1 : _min2; }) + +#define max(x, y) ({ \ + __typeof__(x) _max1 = (x); \ + __typeof__(y) _max2 = (y); \ + (void) (&_max1 == &_max2); \ + _max1 > _max2 ? _max1 : _max2; }) + +#define min_t(type, x, y) min((type) x, (type) y) + +#endif -- cgit v1.2.3