commit bb6e9ddd85cc3d5ab519663d15c48f6d7164e854 Author: Camille Chauvet Date: Wed Nov 23 21:44:27 2022 +0100 d diff --git a/a.out b/a.out new file mode 100755 index 0000000..fed26a4 Binary files /dev/null and b/a.out differ diff --git a/ft_atoi.c b/ft_atoi.c new file mode 100644 index 0000000..8b23edb --- /dev/null +++ b/ft_atoi.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_atoi.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet 0 && ((big >> i) & 1) != tofind) + i--; + return (sizeof(int) * 8 - i - 1); +} diff --git a/ft_get_max.c b/ft_get_max.c new file mode 100644 index 0000000..9312fd0 --- /dev/null +++ b/ft_get_max.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_get_max.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet tab[i]) + min = i; + i++; + } + return (min); +} + +int get_min(int *tab, int size) +{ + return (tab[get_min_index(tab)]); +} diff --git a/ft_isnum.c b/ft_isnum.c new file mode 100644 index 0000000..95193af --- /dev/null +++ b/ft_isnum.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isnum.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = '0' && *str <= '9') || *str == '-' || *str == '+')) + return (0); + str++; + } + return (1); +} diff --git a/ft_p.c b/ft_p.c new file mode 100644 index 0000000..d71a527 --- /dev/null +++ b/ft_p.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_p.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet > (sizeof(int) * 8 - 1)) & 1) == 0) + ft_r(tab_a); + else + ft_p(tab_a, tab_b); + i++; + } + while (0 < ft_tablen(tab_b)) + ft_p(tab_b, tab_a); + } +} diff --git a/ft_s.c b/ft_s.c new file mode 100644 index 0000000..2d69788 --- /dev/null +++ b/ft_s.c @@ -0,0 +1,34 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_s.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet +# include +# include + +int ft_isnum(char *str); +int ft_atoi(char *str); +void ft_putstr(char *str); + +void ft_sort(int *tab, int size); +int ft_get_max_index(int *tab, int len); +int ft_get_max_index(int *tab, int len); +int ft_get_min_index(int *tab, int len); +int ft_get_min_index(int *tab, int len); + +int ft_tablen(int *tab); + +int ft_bit_finder(int big, int tofind); +char **ft_radix_sort(int *tab_a, int *tab_b); + +void ft_swap(int *a, int *b); +void ft_p(int *tab_a, int *tab_b); +void ft_s(int *tab); +void ft_ss(int *tab1, int *tab2); +#endif diff --git a/test.c b/test.c new file mode 100644 index 0000000..4953b95 --- /dev/null +++ b/test.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet +#include "pushswap.h" + +int main() +{ + unsigned int a; + int shift; + + a = 0; + shift = ft_bit_finder(a, 1); + printf("%u / %d\n", shift, 32); + printf("%u", a << shift); +}