summaryrefslogtreecommitdiffstats
path: root/libft
diff options
context:
space:
mode:
Diffstat (limited to 'libft')
-rw-r--r--libft/Makefile2
-rw-r--r--libft/include/libft.h2
-rw-r--r--libft/src/ft_abs.c16
-rw-r--r--libft/src/ft_labs.c16
4 files changed, 36 insertions, 0 deletions
diff --git a/libft/Makefile b/libft/Makefile
index 1c90f66..701d902 100644
--- a/libft/Makefile
+++ b/libft/Makefile
@@ -115,6 +115,8 @@ SRCS_NAME += ft_printf_cat_output.c
SRCS_NAME += ft_printf_flag_to_atoi.c
SRCS_NAME += ft_strsubst.c
SRCS_NAME += ft_strsubst_s.c
+SRCS_NAME += ft_abs.c
+SRCS_NAME += ft_labs.c
#------------------------------------------------------------------------------#
SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME})
#------------------------------------------------------------------------------#
diff --git a/libft/include/libft.h b/libft/include/libft.h
index edd04d4..d2bea38 100644
--- a/libft/include/libft.h
+++ b/libft/include/libft.h
@@ -163,6 +163,8 @@ int ft_putendl(const char *s);
int ft_putchar_fd(char c, int fd);
int ft_putstr_fd(char *s, int fd);
int ft_strcmp(const char *s1, const char *s2);
+int ft_abs(int j);
+long ft_labs(long j);
long ft_memlchr(const void *s, int c, size_t n);
long ft_strlchr(const char *s, int c);
size_t ft_strlen(const char *s);
diff --git a/libft/src/ft_abs.c b/libft/src/ft_abs.c
new file mode 100644
index 0000000..c732fee
--- /dev/null
+++ b/libft/src/ft_abs.c
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_abs.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+int ft_abs(int j)
+{
+ return ((j < 0) ? (-j) : (j));
+}
diff --git a/libft/src/ft_labs.c b/libft/src/ft_labs.c
new file mode 100644
index 0000000..980c005
--- /dev/null
+++ b/libft/src/ft_labs.c
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_labs.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+long ft_labs(long j)
+{
+ return ((j < 0) ? (-j) : (j));
+}