util: refactor intmin/max to standalone file

This commit is contained in:
Edgaru089 2021-10-10 23:45:47 +08:00
parent dfce649314
commit d6ae83b0a8
2 changed files with 11 additions and 4 deletions

View File

@ -4,6 +4,7 @@
#include "color.h" #include "color.h"
#include "unifont.h" #include "unifont.h"
#include "../runtime/stdio.h" #include "../runtime/stdio.h"
#include "../util/minmax.h"
#include <efiprot.h> #include <efiprot.h>
#include <assert.h> #include <assert.h>
@ -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() { void graphics_SwapBuffer() {
memcpy(graphics_DeviceFramebuffer, graphics_Framebuffer, graphics_FramebufferSize); memcpy(graphics_DeviceFramebuffer, graphics_Framebuffer, graphics_FramebufferSize);

10
util/minmax.h Normal file
View File

@ -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;
}