Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
daeb2160
Commit
daeb2160
authored
Jan 13, 2014
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use isfinite() or finite() depending on availability
parent
6169b8d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
skeletons/REAL.c
skeletons/REAL.c
+10
-4
No files found.
skeletons/REAL.c
View file @
daeb2160
...
@@ -27,6 +27,12 @@ static volatile double real_zero GCC_NOTUSED = 0.0;
...
@@ -27,6 +27,12 @@ static volatile double real_zero GCC_NOTUSED = 0.0;
#define INFINITY (1.0/real_zero)
#define INFINITY (1.0/real_zero)
#endif
#endif
#ifdef isfinite
#define _asn_isfinite(d) isfinite(d)
/* ISO C99 */
#else
#define _asn_isfinite(d) finite(d)
/* Deprecated on Mac OS X 10.9 */
#endif
/*
/*
* REAL basic type description.
* REAL basic type description.
*/
*/
...
@@ -88,7 +94,7 @@ REAL__dump(double d, int canonical, asn_app_consume_bytes_f *cb, void *app_key)
...
@@ -88,7 +94,7 @@ REAL__dump(double d, int canonical, asn_app_consume_bytes_f *cb, void *app_key)
buf
=
specialRealValue
[
SRV__NOT_A_NUMBER
].
string
;
buf
=
specialRealValue
[
SRV__NOT_A_NUMBER
].
string
;
buflen
=
specialRealValue
[
SRV__NOT_A_NUMBER
].
length
;
buflen
=
specialRealValue
[
SRV__NOT_A_NUMBER
].
length
;
return
(
cb
(
buf
,
buflen
,
app_key
)
<
0
)
?
-
1
:
buflen
;
return
(
cb
(
buf
,
buflen
,
app_key
)
<
0
)
?
-
1
:
buflen
;
}
else
if
(
!
finite
(
d
))
{
}
else
if
(
!
_asn_is
finite
(
d
))
{
if
(
copysign
(
1
.
0
,
d
)
<
0
.
0
)
{
if
(
copysign
(
1
.
0
,
d
)
<
0
.
0
)
{
buf
=
specialRealValue
[
SRV__MINUS_INFINITY
].
string
;
buf
=
specialRealValue
[
SRV__MINUS_INFINITY
].
string
;
buflen
=
specialRealValue
[
SRV__MINUS_INFINITY
].
length
;
buflen
=
specialRealValue
[
SRV__MINUS_INFINITY
].
length
;
...
@@ -458,7 +464,7 @@ asn_REAL2double(const REAL_t *st, double *dbl_value) {
...
@@ -458,7 +464,7 @@ asn_REAL2double(const REAL_t *st, double *dbl_value) {
return
-
1
;
return
-
1
;
}
}
if
(
used_malloc
)
FREEMEM
(
buf
);
if
(
used_malloc
)
FREEMEM
(
buf
);
if
(
finite
(
d
))
{
if
(
_asn_is
finite
(
d
))
{
*
dbl_value
=
d
;
*
dbl_value
=
d
;
return
0
;
return
0
;
}
else
{
}
else
{
...
@@ -538,7 +544,7 @@ asn_REAL2double(const REAL_t *st, double *dbl_value) {
...
@@ -538,7 +544,7 @@ asn_REAL2double(const REAL_t *st, double *dbl_value) {
m = ldexp(m, scaleF) * pow(pow(2, base), expval);
m = ldexp(m, scaleF) * pow(pow(2, base), expval);
*/
*/
m
=
ldexp
(
m
,
expval
*
baseF
+
scaleF
);
m
=
ldexp
(
m
,
expval
*
baseF
+
scaleF
);
if
(
finite
(
m
))
{
if
(
_asn_is
finite
(
m
))
{
*
dbl_value
=
sign
?
-
m
:
m
;
*
dbl_value
=
sign
?
-
m
:
m
;
}
else
{
}
else
{
errno
=
ERANGE
;
errno
=
ERANGE
;
...
@@ -599,7 +605,7 @@ asn_double2REAL(REAL_t *st, double dbl_value) {
...
@@ -599,7 +605,7 @@ asn_double2REAL(REAL_t *st, double dbl_value) {
st
->
buf
[
0
]
=
0x42
;
/* NaN */
st
->
buf
[
0
]
=
0x42
;
/* NaN */
st
->
buf
[
1
]
=
0
;
st
->
buf
[
1
]
=
0
;
st
->
size
=
1
;
st
->
size
=
1
;
}
else
if
(
!
finite
(
dbl_value
))
{
}
else
if
(
!
_asn_is
finite
(
dbl_value
))
{
if
(
copysign
(
1
.
0
,
dbl_value
)
<
0
.
0
)
{
if
(
copysign
(
1
.
0
,
dbl_value
)
<
0
.
0
)
{
st
->
buf
[
0
]
=
0x41
;
/* MINUS-INFINITY */
st
->
buf
[
0
]
=
0x41
;
/* MINUS-INFINITY */
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment