actually add number.h itself 🤦

This commit is contained in:
r4 2022-05-29 20:46:25 +02:00
parent 8e9ff3b108
commit 4da0422c5a

12
include/ds/number.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef __DS_NUMBER_H__
#define __DS_NUMBER_H__
/* Returns the smaller/larger value of x and y. */
#define min(x, y) ((x) < (y) ? (x) : y)
#define max(x, y) ((x) > (y) ? (x) : y)
/* Tries to calculate x - y. If the result would be negative, returns 0 instead.
* Can safely be used on unsigned types like size_t. */
#define sub_clamped(x, y) ((x) > (y) ? (x) - (y) : 0)
#endif