mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Consolidate MIN and MAX macros
Consolidate MIN and MAX macros and make sure it can be used in combination with glib. Reviewed-by: Philipp Rudo <prudo@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Acked-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
2e28291c75
commit
c55ceabc67
+1
-16
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "zt_common.h"
|
||||
|
||||
void util_hexdump(FILE *fh, const char *tag, const void *data, int cnt);
|
||||
void util_hexdump_grp(FILE *fh, const char *tag, const void *data, int group,
|
||||
@@ -22,22 +23,6 @@ void util_print_indented(const char *str, int indent);
|
||||
|
||||
#define UTIL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
#define MIN(x, y) \
|
||||
({ \
|
||||
__typeof__(x) _x = (x); \
|
||||
__typeof__(y) _y = (y); \
|
||||
\
|
||||
_x < _y ? _x : _y; \
|
||||
})
|
||||
|
||||
#define MAX(x, y) \
|
||||
({ \
|
||||
__typeof__(x) _x = (x); \
|
||||
__typeof__(y) _y = (y); \
|
||||
\
|
||||
_x > _y ? _x : _y; \
|
||||
})
|
||||
|
||||
static inline void util_ptr_vec_free(void **ptr_vec, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -67,6 +67,23 @@
|
||||
|
||||
#define barrier() __asm__ __volatile__("": : :"memory")
|
||||
|
||||
#undef MIN
|
||||
#define MIN(x, y) \
|
||||
({ \
|
||||
__typeof__(x) _x = (x); \
|
||||
__typeof__(y) _y = (y); \
|
||||
\
|
||||
_x < _y ? _x : _y; \
|
||||
})
|
||||
|
||||
#undef MAX
|
||||
#define MAX(x, y) \
|
||||
({ \
|
||||
__typeof__(x) _x = (x); \
|
||||
__typeof__(y) _y = (y); \
|
||||
\
|
||||
_x > _y ? _x : _y; \
|
||||
})
|
||||
|
||||
typedef unsigned long long u64;
|
||||
typedef signed long long s64;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "libc.h"
|
||||
#include "boot/sigp.h"
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
/*
|
||||
* Helper macro for exception table entries
|
||||
|
||||
Reference in New Issue
Block a user