fixed bug in all _generic() functions where [0] was coded by hand, instead of [res_index] ...

This created bugs when shifting, because all the function body is shifted, instead of the first position