https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: fa9ad3a5289541d1346184308d11513e9dbc2058 authored by Dmitry Yu. Naumov on 02 October 2023, 22:02:50 UTC
Merge branch 'FixConstructMeshesFromGeometryBulkElementIds' into 'master'
Tip revision: fa9ad3a
DisableFPE.h
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#if !defined(_WIN32) && !defined(__APPLE__)
#include <cfenv>

class DisableFPE
{
public:
    DisableFPE()
    {
        fegetenv(&fe_env);     // Store floating-point exception handling.
        fesetenv(FE_DFL_ENV);  // Set default environment effectively disabling
                               // exceptions.
    }

    ~DisableFPE()
    {
        fesetenv(&fe_env);  // Restore floating-point exception handling.
    }

private:
    fenv_t fe_env;
};

#else

// No-op for Windows and Apple
class DisableFPE
{
};

#endif
back to top