From d6ae83b0a8259deca4dac82c456dbde1eeccf622 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Sun, 10 Oct 2021 23:45:47 +0800 Subject: [PATCH] util: refactor intmin/max to standalone file --- graphics/graphics.c | 5 +---- util/minmax.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 util/minmax.h diff --git a/graphics/graphics.c b/graphics/graphics.c index 4e4e459..bdac856 100644 --- a/graphics/graphics.c +++ b/graphics/graphics.c @@ -4,6 +4,7 @@ #include "color.h" #include "unifont.h" #include "../runtime/stdio.h" +#include "../util/minmax.h" #include #include @@ -159,10 +160,6 @@ void graphics_ClearBuffer(const HelosGraphics_Color *color) { } } -static inline size_t min(size_t x, size_t y) { - return x < y ? x : y; -} - void graphics_SwapBuffer() { memcpy(graphics_DeviceFramebuffer, graphics_Framebuffer, graphics_FramebufferSize); diff --git a/util/minmax.h b/util/minmax.h new file mode 100644 index 0000000..c1a438e --- /dev/null +++ b/util/minmax.h @@ -0,0 +1,10 @@ +#pragma once + + +static inline int intmin(int x, int y) { + return x < y ? x : y; +} + +static inline int intmax(int x, int y) { + return x > y ? x : y; +}