mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:57:35 +00:00
LibC: Separate arch dependent fenv functions
Remove all functions with platform #if's from fenv, and add arch dependent implementations instead. The build system now selects the implementation based on the platform.
This commit is contained in:
parent
9a207da368
commit
900ec37f81
6 changed files with 405 additions and 268 deletions
108
Userland/Libraries/LibC/arch/riscv64/fenv.cpp
Normal file
108
Userland/Libraries/LibC/arch/riscv64/fenv.cpp
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tom Finet <tom.codeninja@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <fenv.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
int fegetenv(fenv_t* env)
|
||||
{
|
||||
if (!env)
|
||||
return 1;
|
||||
|
||||
(void)env;
|
||||
TODO_RISCV64();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fesetenv(fenv_t const* env)
|
||||
{
|
||||
if (!env)
|
||||
return 1;
|
||||
|
||||
(void)env;
|
||||
TODO_RISCV64();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int feholdexcept(fenv_t* env)
|
||||
{
|
||||
fegetenv(env);
|
||||
|
||||
fenv_t current_env;
|
||||
fegetenv(¤t_env);
|
||||
|
||||
(void)env;
|
||||
TODO_RISCV64();
|
||||
|
||||
fesetenv(¤t_env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fesetexceptflag(fexcept_t const* except, int exceptions)
|
||||
{
|
||||
if (!except)
|
||||
return 1;
|
||||
|
||||
fenv_t current_env;
|
||||
fegetenv(¤t_env);
|
||||
|
||||
exceptions &= FE_ALL_EXCEPT;
|
||||
|
||||
(void)exceptions;
|
||||
(void)except;
|
||||
TODO_RISCV64();
|
||||
|
||||
fesetenv(¤t_env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fegetround()
|
||||
{
|
||||
TODO_RISCV64();
|
||||
}
|
||||
|
||||
int fesetround(int rounding_mode)
|
||||
{
|
||||
if (rounding_mode < FE_TONEAREST || rounding_mode > FE_TOWARDZERO)
|
||||
return 1;
|
||||
|
||||
TODO_RISCV64();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int feclearexcept(int exceptions)
|
||||
{
|
||||
exceptions &= FE_ALL_EXCEPT;
|
||||
|
||||
fenv_t current_env;
|
||||
fegetenv(¤t_env);
|
||||
|
||||
(void)exceptions;
|
||||
TODO_RISCV64();
|
||||
|
||||
fesetenv(¤t_env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fetestexcept(int exceptions)
|
||||
{
|
||||
(void)exceptions;
|
||||
TODO_RISCV64();
|
||||
}
|
||||
|
||||
int feraiseexcept(int exceptions)
|
||||
{
|
||||
fenv_t env;
|
||||
fegetenv(&env);
|
||||
|
||||
exceptions &= FE_ALL_EXCEPT;
|
||||
|
||||
(void)exceptions;
|
||||
TODO_RISCV64();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue