Exact Riemann solver in C++ translated from Marti&Muller