Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
ef219fd6
Commit
ef219fd6
authored
Apr 09, 2013
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure NAN is always initialized.
parent
7e8fc267
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
21 deletions
+14
-21
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+0
-20
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+13
-0
No files found.
Cython/Compiler/Naming.py
View file @
ef219fd6
...
...
@@ -133,7 +133,7 @@ h_guard_prefix = "__PYX_HAVE__"
api_guard_prefix
=
"__PYX_HAVE_API__"
api_func_guard
=
"__PYX_HAVE_API_FUNC_"
PYX_NAN
=
"__PYX_NAN"
PYX_NAN
=
"__PYX_NAN
()
"
def
py_version_hex
(
major
,
minor
=
0
,
micro
=
0
,
release_level
=
0
,
release_serial
=
0
):
return
(
major
<<
24
)
|
(
minor
<<
16
)
|
(
micro
<<
8
)
|
(
release_level
<<
4
)
|
(
release_serial
)
Cython/Compiler/Nodes.py
View file @
ef219fd6
...
...
@@ -7082,8 +7082,6 @@ class ParallelStatNode(StatNode, ParallelNode):
if
first
:
code
.
putln
(
"/* Initialize private variables to "
"invalid values */"
)
code
.
globalstate
.
use_utility_code
(
invalid_values_utility_code
)
first
=
False
code
.
putln
(
"%s = %s;"
%
(
entry
.
cname
,
entry
.
type
.
cast_code
(
invalid_value
)))
...
...
@@ -8156,21 +8154,3 @@ bad:
return NULL;
}
"""
)
################ Utility code for cython.parallel stuff ################
invalid_values_utility_code
=
UtilityCode
(
proto
=
"""
\
#include <string.h>
void __pyx_init_nan(void);
static float %(PYX_NAN)s;
"""
%
vars
(
Naming
),
init
=
"""
/* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
a quiet NaN. */
memset(&%(PYX_NAN)s, 0xFF, sizeof(%(PYX_NAN)s));
"""
%
vars
(
Naming
))
Cython/Utility/ModuleSetupCode.c
View file @
ef219fd6
...
...
@@ -262,6 +262,19 @@
#define __Pyx_DOCSTR(n) (n)
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static
inline
float
__PYX_NAN
()
{
/* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
a quiet NaN. */
float
value
;
memset
(
&
value
,
0xFF
,
sizeof
(
value
));
return
value
;
}
#endif
/////////////// UtilityFunctionPredeclarations.proto ///////////////
/* inline attribute */
...
...
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