ref: 2c410b56f801708ec11a1af6cdd995d69e9db059
parent: 5ebbe977e9a25feff261b7c5fbbfe7af777dd681
author: rodri <rgl@antares-labs.eu>
date: Tue Aug 27 08:05:08 EDT 2024
replace f?(min|max) functions with type-agnostic macros. this simplifies the code and serves as another shadeop to use on application shaders.
--- a/graphics.h
+++ b/graphics.h
@@ -1,4 +1,6 @@
#define HZ2MS(hz) (1000/(hz))
+#define min(a, b) ((a)<(b)?(a):(b))
+#define max(a, b) ((a)>(b)?(a):(b))
typedef enum {
ORTHOGRAPHIC,
@@ -412,8 +414,6 @@
Color samplecubemap(Cubemap*, Point3, Color(*)(Texture*, Point2));
/* util */
-double fmin(double, double);
-double fmax(double, double);
Point2 modulapt2(Point2, Point2);
Point3 modulapt3(Point3, Point3);
Memimage *rgb(ulong);
--- a/internal.h
+++ b/internal.h
@@ -55,8 +55,6 @@
int rectclipline(Rectangle, Point*, Point*, Vertex*, Vertex*);
/* util */
-int min(int, int);
-int max(int, int);
void memsetf(void*, float, usize);
void memsetl(void*, ulong, usize);
--- a/util.c
+++ b/util.c
@@ -8,30 +8,6 @@
#include "graphics.h"
#include "internal.h"
-int
-min(int a, int b)
-{
- return a < b? a: b;
-}
-
-int
-max(int a, int b)
-{
- return a > b? a: b;
-}
-
-double
-fmin(double a, double b)
-{
- return a < b? a: b;
-}
-
-double
-fmax(double a, double b)
-{
- return a > b? a: b;
-}
-
Point2
modulapt2(Point2 a, Point2 b)
{