actually add number.h itself 🤦
This commit is contained in:
parent
8e9ff3b108
commit
4da0422c5a
12
include/ds/number.h
Normal file
12
include/ds/number.h
Normal 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
|
Loading…
Reference in New Issue
Block a user