diff options
Diffstat (limited to 'src/ft_sort_s_t.c')
-rw-r--r-- | src/ft_sort_s_t.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index f015abc..702d5e6 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -20,18 +20,40 @@ /*clearpilled*/ void +ft_init_st(int32_t st_o[8]) +{ + int8_t i; + + i = -1; + while (++i < 3) + st_o[i] = i; +} + +void ft_sort_s_t(t_cub *cl, float dist_tab[8][4096]) { - uint16_t i; + int16_t i; int32_t tmp; + float *tmp_i; - i = 0; - while (i < cl->mlist.sprite_var) + i = -1; + ft_init_st(cl->mlist.st_o); + tmp_i = ft_calloc(sizeof(int32_t), 4096); + while (++i < cl->mlist.sprite_var) { if (dist_tab[i][0] < dist_tab[i + 1][0]) { - i = 0; + tmp = cl->mlist.st_o[i]; + cl->mlist.st_o[i] = cl->mlist.st_o[i + 1]; + cl->mlist.st_o[i + 1] = tmp; + ft_memcpy(tmp_i, dist_tab[i], 4096); + ft_memcpy(dist_tab[i], dist_tab[i + 1], 4096); + ft_memcpy(dist_tab[i + 1], tmp_i, 4096); + i = -1; } - i++; } + i = -1; + while (++i < 3) + printf("%d\n", cl->mlist.st_o[i]); + puts("-------------------------"); } |