added bgoulard lib + made lib sources in their own directory in build/ for readability
This commit is contained in:
parent
83cc8419a0
commit
0a390934d6
457 changed files with 21807 additions and 61 deletions
38
libft_personal/src/ft_math/ft_clamp.c
Normal file
38
libft_personal/src/ft_math/ft_clamp.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_torange.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/16 14:51:08 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/05/16 15:04:23 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_clamp(int value, int min, int max)
|
||||
{
|
||||
if (value < min)
|
||||
return (min);
|
||||
else if (value > max)
|
||||
return (max);
|
||||
return (value);
|
||||
}
|
||||
|
||||
float ft_clamp_f(float value, float min, float max)
|
||||
{
|
||||
if (value < min)
|
||||
return (min);
|
||||
else if (value > max)
|
||||
return (max);
|
||||
return (value);
|
||||
}
|
||||
|
||||
double ft_clamp_d(double value, double min, double max)
|
||||
{
|
||||
if (value < min)
|
||||
return (min);
|
||||
else if (value > max)
|
||||
return (max);
|
||||
return (value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue