Switch smooth code from C to C++ in preparation for supporting different float types