-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm_fdf_math.c
41 lines (36 loc) · 1.21 KB
/
m_fdf_math.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* m_fdf_math.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nkawaguc <nkawaguc@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/28 12:18:42 by nkawaguc #+# #+# */
/* Updated: 2024/10/28 12:18:43 by nkawaguc ### ########.fr */
/* */
/* ************************************************************************** */
#include "m_fdf_math.h"
int fdf_abs(int n)
{
if (n < 0)
return (-n);
return (n);
}
int fdf_max(int a, int b)
{
if (a > b)
return (a);
return (b);
}
int fdf_min(int a, int b)
{
if (a < b)
return (a);
return (b);
}
int in_div(int p1, int p2, int i, int total)
{
if (total == 0)
return (p1);
return (p1 + (p2 - p1) * i / total);
}