diff --git a/a.out b/a.out deleted file mode 100755 index 5d54d14..0000000 Binary files a/a.out and /dev/null differ diff --git a/check.sh b/check.sh new file mode 100755 index 0000000..6c27d5d --- /dev/null +++ b/check.sh @@ -0,0 +1 @@ +./push_swap $@ | ./checker_linux $@ diff --git a/checker_linux b/checker_linux new file mode 100755 index 0000000..002d593 Binary files /dev/null and b/checker_linux differ diff --git a/ft_bit_finder.c b/ft_bit_finder.c index c8b63ca..39df024 100644 --- a/ft_bit_finder.c +++ b/ft_bit_finder.c @@ -6,7 +6,7 @@ /* By: cchauvet = 0 && !ft_is_sorted(tab_a)) + tab_index = ft_tablen(tab_a) - 1; + loop_index = tab_index; + shift = ft_bit_finder_right(ft_get_bit_min(tab_a), 1); + while (loop_index > 0 && !ft_is_sorted(tab_a)) { - if ((tab_a[i] >> (sizeof(int) * 8 -1) & 1) == 0) + if (tab_a[tab_index] >> shift & 1) + { ft_pb(tab_a, tab_b); + tab_index--; + } else ft_ra(tab_a); + loop_index--; } while (tab_b[0] != -1) ft_pa(tab_a, tab_b); - i = ft_tablen(tab_a); - while (--i >= 0 && !ft_is_sorted(tab_a)) - tab_a[i] = tab_a[i] << 1; + tab_index = ft_tablen(tab_a); + while (--tab_index >= 0 && !ft_is_sorted(tab_a)) + tab_a[tab_index] = tab_a[tab_index] << 1; } + free(tab_a); + free(tab_b); } diff --git a/ft_radix.o b/ft_radix.o index 498ab77..06bd29d 100644 Binary files a/ft_radix.o and b/ft_radix.o differ diff --git a/ft_split.c b/ft_split.c new file mode 100644 index 0000000..c512def --- /dev/null +++ b/ft_split.c @@ -0,0 +1,92 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_split.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet