This code is still from the original CAST git commit. Notice the "else if" makes no sense. As this function checks if the torsion from the aprameter file matches the current atoms, it is maybe(!) supposed to be:
else if (index[0] == d && index[1] == c && index[2] == b && index[3] == a) return 4u;
Yes, I think this supposed to be as you suggested but I also think it doesn't matter because the last line also returns 4 if all the indices are identical.
This code is still from the original CAST git commit. Notice the "else if" makes no sense. As this function checks if the torsion from the aprameter file matches the current atoms, it is maybe(!) supposed to be:
else if (index[0] == d && index[1] == c && index[2] == b && index[3] == a) return 4u;
but I am not sure?