From e0ddc62bd02a4aa3011bc401f6d7a70fe07b88c5 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 26 Nov 2025 15:10:39 +0100 Subject: [PATCH] os: add header for math related functions (possibly OS optimized) Adding a new header for math related functions, beginning with new MIN/MAX macros, which will be used by subsequent commits. Signed-off-by: Enrico Weigelt, metux IT consult --- include/misc.h | 2 +- os/mathx_priv.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 os/mathx_priv.h diff --git a/include/misc.h b/include/misc.h index 7a2bd7776..3c04594eb 100644 --- a/include/misc.h +++ b/include/misc.h @@ -122,7 +122,7 @@ typedef int XRetCode; #undef min #undef max - +/* @deprecated */ #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) /* abs() is a function, not a macro; include the file declaring diff --git a/os/mathx_priv.h b/os/mathx_priv.h new file mode 100644 index 000000000..956be0a37 --- /dev/null +++ b/os/mathx_priv.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#ifndef _XSERVER_OS_MATHX_PRIV_H_ +#define _XSERVER_OS_MATHX_PRIV_H_ + +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif + +#endif /* _XSERVER_OS_MATHX_PRIV_H_ */