diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 14:27:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 14:27:35 +0000 |
commit | 78f0e21e4be26a0792535ede952c5836d66d1965 (patch) | |
tree | 4d43dd4ea1e336065ba7208e974f29afe542b7d2 /linux_mm.h | |
parent | Initial commit. (diff) | |
download | xlunzip-upstream/0.7.tar.xz xlunzip-upstream/0.7.zip |
Adding upstream version 0.7.upstream/0.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'linux_mm.h')
-rw-r--r-- | linux_mm.h | 36 |
1 files changed, 36 insertions, 0 deletions
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 <limits.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + +/* + * 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 |