From f4e1232957b1270da70f57fcad4cd6371947e442 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 19 Jan 2020 08:30:03 +0100 Subject: Added algo functions ft_qsort, ft_is_set, ft_memswap, ft_compar_int --- libft.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'libft.h') diff --git a/libft.h b/libft.h index 6e767fd..f84c16e 100644 --- a/libft.h +++ b/libft.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/07 09:45:02 by cacharle #+# #+# */ -/* Updated: 2020/01/15 14:46:50 by cacharle ### ########.fr */ +/* Updated: 2020/02/02 22:09:47 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,7 @@ # define FALSE 0 typedef unsigned char t_byte; +typedef int t_bool; typedef struct s_list { @@ -33,6 +34,12 @@ void *ft_memccpy(void *dest, const void *src, int c, size_t n); void *ft_memmove(void *dst, const void *src, size_t len); void *ft_memchr(const void *s, int c, size_t n); int ft_memcmp(const void *s1, const void *s2, size_t n); +void ft_memswap(void *a, void *b, size_t size); + +/* +** str +*/ + size_t ft_strlen(const char *s); char *ft_strdup(const char *s); char *ft_strcpy(char *dest, const char *src); @@ -98,4 +105,18 @@ void ft_lstiter(t_list *lst, void (*f)(void *)); t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); +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 -- cgit