0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-02 20:09:16 +01:00
construct/include/ircd/util/fpe.h

43 lines
1.2 KiB
C
Raw Normal View History

// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
2019-02-16 22:14:25 +01:00
#define HAVE_IRCD_UTIL_FPE_H
namespace ircd {
inline namespace util {
namespace fpe
{
struct errors_handle;
string_view reflect_sicode(const int &);
string_view reflect(const ushort &flag);
string_view reflect(const mutable_buffer &, const ushort &flags);
void throw_errors(const ushort &flags);
std::fexcept_t set(const ushort &flag);
}}}
/// Perform a single floating point operation at a time within the scope
/// of fpe::errors_handle. After each operation check the floating point
/// unit for an error status flag and throw a C++ exception.
2019-02-16 22:14:25 +01:00
struct ircd::util::fpe::errors_handle
{
std::fexcept_t theirs;
public:
ushort pending() const;
void throw_pending() const;
void clear_pending();
errors_handle();
~errors_handle() noexcept(false);
};