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
Xavier Thompson
cython
Commits
7e2e63ab
Commit
7e2e63ab
authored
Apr 03, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments
parent
44694afc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
Cython/Utility/__init__.py
Cython/Utility/__init__.py
+5
-1
No files found.
Cython/Utility/__init__.py
View file @
7e2e63ab
...
...
@@ -3,6 +3,8 @@ def pylong_join(count, digits_ptr='digits', join_type='unsigned long'):
"""
Generate an unrolled shift-then-or loop over the first 'count' digits.
Assumes that they fit into 'join_type'.
(((d[2] << n) | d[1]) << n) | d[0]
"""
return
(
'('
*
(
count
*
2
)
+
"(%s)"
%
join_type
+
' | '
.
join
(
"%s[%d])%s)"
%
(
digits_ptr
,
_i
,
" << PyLong_SHIFT"
if
_i
else
''
)
...
...
@@ -13,8 +15,10 @@ def pylong_join(count, digits_ptr='digits', join_type='unsigned long'):
# this implementation is a bit slower than the simpler one above
def
_pylong_join
(
count
,
digits_ptr
=
'digits'
,
join_type
=
'unsigned long'
):
"""
Generate an
unrolled shift-then-or loop ove
r the first 'count' digits.
Generate an
or-ed series of shifts fo
r the first 'count' digits.
Assumes that they fit into 'join_type'.
(d[2] << 2*n) | (d[1] << 1*n) | d[0]
"""
def
shift
(
n
):
# avoid compiler warnings for overly large shifts that will be discarded anyway
...
...
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