Skip to content

Commit 5002868

Browse files
committed
[CRT:MATH] Implement _dsign and _dsignf
1 parent 0e5d6af commit 5002868

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

dll/win32/ucrtbase/ucrtbase.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
@ cdecl -stub _dpcomp(double double)
307307
@ cdecl -stub _dpoly(double ptr long)
308308
@ cdecl -stub _dscale(ptr long)
309-
@ cdecl -stub _dsign(double)
309+
@ cdecl _dsign(double)
310310
@ cdecl -stub _dsin(double long)
311311
@ cdecl _dtest(ptr)
312312
@ cdecl -stub _dunscale(ptr ptr)
@@ -349,7 +349,7 @@
349349
@ cdecl -stub _fdpcomp(float float)
350350
@ cdecl -stub _fdpoly(float ptr long)
351351
@ cdecl -stub _fdscale(ptr long)
352-
@ cdecl -stub _fdsign(float)
352+
@ cdecl _fdsign(float)
353353
@ cdecl -stub _fdsin(float long)
354354
@ cdecl _fdtest(ptr)
355355
@ cdecl -stub _fdunscale(ptr ptr)

sdk/lib/crt/math/_dsign.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* PROJECT: ReactOS CRT
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: Implementation of _dsign.
5+
* COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include <math.h>
9+
#include <stdint.h>
10+
11+
_Check_return_
12+
int
13+
__cdecl
14+
_dsign(_In_ double _X)
15+
{
16+
union { double f; uint64_t ui64; } u = { _X };
17+
18+
// This is what Windows returns
19+
return (u.ui64 >> 48) & 0x8000;
20+
}

sdk/lib/crt/math/_fdsign.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* PROJECT: ReactOS CRT
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: Implementation of _fdsign.
5+
* COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include <math.h>
9+
#include <stdint.h>
10+
11+
_Check_return_
12+
int
13+
__cdecl
14+
_fdsign(_In_ float _X)
15+
{
16+
union { float f; uint32_t ui32; } u = { _X };
17+
18+
// This is what Windows returns
19+
return (u.ui32 >> 16) & 0x8000;
20+
}

sdk/lib/crt/math/math.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ include_directories(libm_sse2)
33

44
list(APPEND LIBCNTPR_MATH_SOURCE
55
math/_chgsignf.c
6+
math/_dsign.c
7+
math/_fdsign.c
68
math/_invoke_matherr.c
79
math/abs.c
810
math/div.c

0 commit comments

Comments
 (0)