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
Kirill Smelkov
cython
Commits
46fd1f5f
Commit
46fd1f5f
authored
8 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use potentially platform optimised memchr() in utility function instead of hand written for-loop
parent
7bc65bef
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
Cython/Utility/StringTools.c
Cython/Utility/StringTools.c
+2
-5
No files found.
Cython/Utility/StringTools.c
View file @
46fd1f5f
...
...
@@ -48,15 +48,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
static
CYTHON_INLINE
int
__Pyx_BytesContains
(
PyObject
*
bytes
,
char
character
);
/*proto*/
//////////////////// BytesContains ////////////////////
//@requires: IncludeStringH
static
CYTHON_INLINE
int
__Pyx_BytesContains
(
PyObject
*
bytes
,
char
character
)
{
const
Py_ssize_t
length
=
PyBytes_GET_SIZE
(
bytes
);
char
*
char_start
=
PyBytes_AS_STRING
(
bytes
);
char
*
pos
;
for
(
pos
=
char_start
;
pos
<
char_start
+
length
;
pos
++
)
{
if
(
character
==
pos
[
0
])
return
1
;
}
return
0
;
return
memchr
(
char_start
,
(
unsigned
char
)
character
,
(
size_t
)
length
)
!=
NULL
;
}
...
...
This diff is collapsed.
Click to expand it.
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