Skip to content

Commit 84252fc

Browse files
committed
math: Move __signbitf to separate file
There's no reason to combine __signbit and __signbitf in one file. Signed-off-by: Keith Packard <[email protected]>
1 parent a95140c commit 84252fc

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed

newlib/libm/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ picolibc_sources(
120120
sf_remquo.c
121121
sf_round.c
122122
sf_scalbln.c
123+
sf_signbit.c
123124
sf_trunc.c
124125
sf_exp2_data.c
125126
sf_log_data.c

newlib/libm/common/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ fsrcs_common = [
9797
'sf_copysign.c',
9898
'sf_modf.c',
9999
'sf_scalbn.c',
100+
'sf_signbit.c',
100101
'sf_cbrt.c',
101102
'sf_exp10.c',
102103
'sf_expm1.c',

newlib/libm/common/s_signbit.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ C99, POSIX.
3737

3838
#include "fdlibm.h"
3939

40-
int
41-
__signbitf (float x)
42-
{
43-
__uint32_t w;
44-
45-
GET_FLOAT_WORD(w,x);
46-
47-
return (w & 0x80000000) != 0;
48-
}
49-
50-
_MATH_ALIAS_i_f(__signbit)
51-
5240
#ifdef _NEED_FLOAT64
5341
int
5442
__signbit64(__float64 x)

newlib/libm/common/sf_signbit.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
2+
*
3+
* Permission to use, copy, modify, and distribute this software
4+
* is freely granted, provided that this notice is preserved.
5+
*/
6+
/*
7+
FUNCTION
8+
<<signbit>>---Does floating-point number have negative sign?
9+
10+
INDEX
11+
signbit
12+
13+
SYNOPSIS
14+
#include <math.h>
15+
int signbit(real-floating <[x]>);
16+
17+
DESCRIPTION
18+
The <<signbit>> macro determines whether the sign of its argument value is
19+
negative. The macro reports the sign of all values, including infinities,
20+
zeros, and NaNs. If zero is unsigned, it is treated as positive. As shown in
21+
the synopsis, the argument is "real-floating," meaning that any of the real
22+
floating-point types (float, double, etc.) may be given to it.
23+
24+
Note that because of the possibilities of signed 0 and NaNs, the expression
25+
"<[x]> < 0.0" does not give the same result as <<signbit>> in all cases.
26+
27+
RETURNS
28+
The <<signbit>> macro returns a nonzero value if and only if the sign of its
29+
argument value is negative.
30+
31+
PORTABILITY
32+
C99, POSIX.
33+
34+
*/
35+
36+
#define _ADD_D_TO_DOUBLE_FUNCS
37+
38+
#include "fdlibm.h"
39+
40+
int
41+
__signbitf (float x)
42+
{
43+
__uint32_t w;
44+
45+
GET_FLOAT_WORD(w,x);
46+
47+
return (w & 0x80000000) != 0;
48+
}
49+
50+
_MATH_ALIAS_i_f(__signbit)

0 commit comments

Comments
 (0)