mirror of
https://github.com/recp/cglm.git
synced 2025-10-03 16:51:35 +00:00
Add int min and max functions
This commit is contained in:
@@ -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
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user