Update SP_check_if_end.c

we have done the check of diagonally like that, with an enormous if, if you ssee that it doesnt works, plase send a mail to us, cause we have another way to do it