From bb6e9ddd85cc3d5ab519663d15c48f6d7164e854 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Wed, 23 Nov 2022 21:44:27 +0100 Subject: [PATCH] d --- a.out | Bin 0 -> 20216 bytes ft_atoi.c | 36 +++++++++++++++++++++++++++ ft_bit_finder.c | 23 ++++++++++++++++++ ft_get_max.c | 36 +++++++++++++++++++++++++++ ft_get_min.c | 36 +++++++++++++++++++++++++++ ft_isnum.c | 24 ++++++++++++++++++ ft_p.c | 27 +++++++++++++++++++++ ft_putstr.c | 19 +++++++++++++++ ft_radix.c | 33 +++++++++++++++++++++++++ ft_s.c | 34 ++++++++++++++++++++++++++ ft_sort.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ ft_swap.c | 22 +++++++++++++++++ ft_tablen.c | 23 ++++++++++++++++++ main.c | 36 +++++++++++++++++++++++++++ pushswap.h | 38 +++++++++++++++++++++++++++++ test.c | 25 +++++++++++++++++++ 16 files changed, 475 insertions(+) create mode 100755 a.out create mode 100644 ft_atoi.c create mode 100644 ft_bit_finder.c create mode 100644 ft_get_max.c create mode 100644 ft_get_min.c create mode 100644 ft_isnum.c create mode 100644 ft_p.c create mode 100644 ft_putstr.c create mode 100644 ft_radix.c create mode 100644 ft_s.c create mode 100644 ft_sort.c create mode 100644 ft_swap.c create mode 100644 ft_tablen.c create mode 100644 main.c create mode 100644 pushswap.h create mode 100644 test.c diff --git a/a.out b/a.out new file mode 100755 index 0000000000000000000000000000000000000000..fed26a4af7b18159074124d06f42f54bf88416e4 GIT binary patch literal 20216 zcmeHPe{dAneSdqWlWvi8Iw3Fu8aOa+psr2=gOI>7`pqd7Kf;d~$HuGE-JW#jbf?_y zf#lRSt!$4~LJKo(<2ZEe=AY6@+qlzqhC0&(O6nieHiqd;>%^0mxOJ+eZj7mup)vUS z`M!PM)86Xjw3+s=-h1tGV%g> zjZqrg#bh>_wi3cHVpCBgkxWNZ$wy6~Bw^&NXx1_&qRF(_Jv`LgXKV>?32zg|(4jp>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DJc!&uCPG0U7Zv(~hOG@4K1uQw#) ziqz9PgsJJ6kmBQ*dWvv-It>>##C%M0j$^uy$!G~;fR{B>QBqK~$&@9+vgKh^!($ns zRLPk!5w^@JpwtT?oslOhY>umbHy(#I#%vpQ2edV~4p-5MB#hbW$gT*Z^G~2dgJzEA z#~>L^k71-JG?`9hxE>uH&6>vkC@Jm0occ%9JeA>w5^1`pmX;xxKF@O*hDya3=+lFuALAK6 z$Nz%z&yf9BD?9G^qoCtyPO<$wZ)SL2=}{Xg&#X_6W~e0bBbV%-=hqCMBq2v38_x0> zAoLD{^?4r7kmf~HIDVF6_&9jEbKN7Mf8E&M`;V9gHnDjO(G)C00FV5rn?+m%+8E5z&bQ>J{ z{GRn<3y3HzXJhj?(`i0UeV6_7{G9)86#soF8h=z+kMsIv(5Q*5&+EVoYGN26B}ZX> zhSgAZ>WgkA+-5`e!zNgd@j56Ijs5d{GN|<3^5n}|8kK(~USzTU-9?IBVSR?Hl)g($ z>{JFvTnyG@@}@=fzo_&db9FekK0UT})5v!7HrvDRyO=Ii^ev))iEfN2H(UxXRP0mw z?)?2phpk^I4on+oeJ6B@NWlv`ZTXAp!nz*lR{Z#U@^zWszw^1bHSFV5uMO9`jI&>s UZA7J<{&W4d1g+Pc#f6Ih0<*E;z5oCK literal 0 HcmV?d00001 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); +}