The equation you posted has not so much to do with zero crossing detection, I assume you want to find out if the last sample of your loop buffer is near the first one to avoid big jumps, right? It might be possible that you’ll find such a case but it’s luck and relatively unlikely.
Zero detection means that you should modify your buffer in such a way that it always starts and ends with a sample with the value zero. You do that by scanning the start and end of your buffer for the first / last time your sample values change from positive to negative or the other way round.
Now you could try just setting all samples before and after that point hard to zero or apply a gain ramp over a few samples at the beginning and the end of the buffer. Give it a try, maybe it is that simple.
By the way, I just had a quick look at the link from your first post. Seems like the topic there is spotting clicks in recorded material that were caused by bad cables, microphones or something like that rather than smoothing out artificial clicking caused by cuts that are not located at a zero crossing point.