aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-19 08:30:03 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-19 08:30:03 +0100
commita5b068767440327f910dfa815be12ff4c0d94309 (patch)
treee38b20b1b29b3eb0b440a8b0964f19d3027980ef /include
parent676b37f963789f3d85b18ed5b3708374971b65e2 (diff)
downloadlibft-a5b068767440327f910dfa815be12ff4c0d94309.tar.gz
libft-a5b068767440327f910dfa815be12ff4c0d94309.tar.bz2
libft-a5b068767440327f910dfa815be12ff4c0d94309.zip
Added algo functions ft_qsort, ft_is_set, ft_memswap, ft_compar_int
Diffstat (limited to 'include')
-rw-r--r--include/ft_algo.h32
-rw-r--r--include/libft.h6
2 files changed, 35 insertions, 3 deletions
diff --git a/include/ft_algo.h b/include/ft_algo.h
new file mode 100644
index 0000000..4175cb5
--- /dev/null
+++ b/include/ft_algo.h
@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_algo.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/19 07:22:57 by cacharle #+# #+# */
+/* Updated: 2020/01/19 08:27:44 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_ALGO_H
+# define FT_ALGO_H
+
+typedef int t_bool;
+
+typedef struct
+{
+ int lo;
+ int hi;
+} t_ftrange;
+
+typedef int (*t_ftcompar_func)(const void*, const void*);
+
+t_bool ft_is_set(void *base, size_t nel, size_t width,
+ t_ftcompar_func compar);
+void ft_qsort(void *base, size_t nel, size_t width,
+ t_ftcompar_func compar);
+int ft_compar_int(const void *a, const void *b);
+
+#endif
diff --git a/include/libft.h b/include/libft.h
index c2215ed..888ac8c 100644
--- a/include/libft.h
+++ b/include/libft.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:45:02 by cacharle #+# #+# */
-/* Updated: 2020/01/15 12:52:37 by cacharle ### ########.fr */
+/* Updated: 2020/01/19 08:20:37 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,11 +18,10 @@
# include <stdlib.h>
# include <stddef.h>
# include <limits.h>
-
# include <errno.h>
-
# include "get_next_line.h"
+# include "ft_algo.h"
# ifdef __linux__
# include <stdio.h>
@@ -118,6 +117,7 @@ int ft_memcmp(const void *s1, const void *s2, size_t n);
void *ft_memalloc(size_t size);
void ft_memdel(void **ap);
void *ft_calloc(size_t count, size_t size);
+void ft_memswap(void *a, void *b, size_t size);
/*
** str