From 577b4c73b0ae4dd9163be483de0b50d9d468c690 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 29 Apr 2022 20:29:05 +0200 Subject: [PATCH] LibC: Add MIN, MAX and howmany macros to sys/param.h --- Userland/Libraries/LibC/sys/param.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibC/sys/param.h b/Userland/Libraries/LibC/sys/param.h index 52c24437d2..319b7f0f76 100644 --- a/Userland/Libraries/LibC/sys/param.h +++ b/Userland/Libraries/LibC/sys/param.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ @@ -8,3 +8,15 @@ #include #include + +#ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef howmany +# define howmany(x, y) (((x) + ((y)-1)) / (y)) +#endif