Add int min and max functions

This commit is contained in:
BeeverFeever
2023-12-25 12:50:29 +11:00
parent d341478342
commit 7701a1a789

View File

@@ -147,6 +147,38 @@ glm_max(float a, float b) {
return b; return b;
} }
/*!
* @brief find minimum of given two values
*
* @param[in] a number 1
* @param[in] b number 2
*
* @return smallest of the two values
*/
CGLM_INLINE
int
glm_imin(int a, int b) {
if (a < b)
return a;
return b;
}
/*!
* @brief find maximum of given two values
*
* @param[in] a number 1
* @param[in] b number 2
*
* @return largest of the two values
*/
CGLM_INLINE
int
glm_imax(int a, int b) {
if (a > b)
return a;
return b;
}
/*! /*!
* @brief clamp a number between min and max * @brief clamp a number between min and max
* *