mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::util::fpe: Add interface to set the except flag.
This commit is contained in:
parent
19e09b0ad5
commit
63d591b2b8
2 changed files with 11 additions and 1 deletions
|
@ -18,7 +18,9 @@ namespace ircd::util::fpe
|
|||
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
|
||||
|
@ -26,7 +28,7 @@ namespace ircd::util::fpe
|
|||
/// unit for an error status flag and throw a C++ exception.
|
||||
struct ircd::util::fpe::errors_handle
|
||||
{
|
||||
fexcept_t theirs;
|
||||
std::fexcept_t theirs;
|
||||
|
||||
public:
|
||||
ushort pending() const;
|
||||
|
|
|
@ -32,6 +32,14 @@ ircd::util::size(std::ostream &s)
|
|||
#pragma STDC FENV_ACCESS on
|
||||
#endif
|
||||
|
||||
std::fexcept_t
|
||||
ircd::util::fpe::set(const ushort &flags)
|
||||
{
|
||||
std::fexcept_t theirs;
|
||||
syscall(std::fesetexceptflag, &theirs, flags);
|
||||
return theirs;
|
||||
}
|
||||
|
||||
void
|
||||
ircd::util::fpe::throw_errors(const ushort &flags)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue