mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 13:13:00 +00:00
[CRT] Add round and roundf and add it to msvcrtex to make clang v14 happy
This commit is contained in:
parent
83faa2da5e
commit
bc9409daba
4 changed files with 37 additions and 0 deletions
16
sdk/lib/crt/math/round.c
Normal file
16
sdk/lib/crt/math/round.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* PURPOSE: Portable implementation of round
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
double round(double arg)
|
||||
{
|
||||
if (arg < 0.0)
|
||||
return ceil(arg - 0.5);
|
||||
else
|
||||
return floor(arg + 0.5);
|
||||
}
|
16
sdk/lib/crt/math/roundf.c
Normal file
16
sdk/lib/crt/math/roundf.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* PURPOSE: Portable implementation of roundf
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float roundf(float arg)
|
||||
{
|
||||
if (arg < 0.0)
|
||||
return ceilf(arg - 0.5);
|
||||
else
|
||||
return floorf(arg + 0.5);
|
||||
}
|
|
@ -13,6 +13,8 @@ list(APPEND MSVCRTEX_SOURCE
|
|||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# Clang performs some optimizations requiring those funtions
|
||||
list(APPEND MSVCRTEX_SOURCE
|
||||
math/round.c
|
||||
math/roundf.c
|
||||
math/exp2.c
|
||||
math/exp2f.c
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue