Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyFastANI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Larralde
PyFastANI
Commits
f7afa594
Commit
f7afa594
authored
3 years ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Update `sse2_copy_upper` to use a single bitmask
parent
b32a0c40
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyfastani/_sequtils/sse2.c
+1
-7
1 addition, 7 deletions
pyfastani/_sequtils/sse2.c
with
1 addition
and
7 deletions
pyfastani/_sequtils/sse2.c
+
1
−
7
View file @
f7afa594
...
@@ -2,17 +2,11 @@
...
@@ -2,17 +2,11 @@
#include
<x86intrin.h>
#include
<x86intrin.h>
extern
void
sse2_copy_upper
(
char
*
dst
,
const
char
*
src
,
size_t
len
)
{
extern
void
sse2_copy_upper
(
char
*
dst
,
const
char
*
src
,
size_t
len
)
{
const
__m128i
ascii_a
=
_mm_set1_epi8
(
'a'
-
1
);
const
__m128i
ascii_z
=
_mm_set1_epi8
(
'z'
);
const
__m128i
offset
=
_mm_set1_epi8
(
'a'
-
'A'
);
const
__m128i
offset
=
_mm_set1_epi8
(
'a'
-
'A'
);
while
(
len
>=
sizeof
(
__m128i
))
{
while
(
len
>=
sizeof
(
__m128i
))
{
__m128i
inp
=
_mm_loadu_si128
((
__m128i
*
)
src
);
__m128i
inp
=
_mm_loadu_si128
((
__m128i
*
)
src
);
__m128i
greater_than_a
=
_mm_cmpgt_epi8
(
inp
,
ascii_a
);
__m128i
added
=
_mm_andnot_si128
(
offset
,
inp
);
__m128i
less_equal_z
=
_mm_cmpgt_epi8
(
ascii_z
,
inp
);
__m128i
mask
=
_mm_and_si128
(
greater_than_a
,
less_equal_z
);
__m128i
diff
=
_mm_and_si128
(
mask
,
offset
);
__m128i
added
=
_mm_sub_epi8
(
inp
,
diff
);
_mm_storeu_si128
((
__m128i
*
)
dst
,
added
);
_mm_storeu_si128
((
__m128i
*
)
dst
,
added
);
len
-=
sizeof
(
__m128i
);
len
-=
sizeof
(
__m128i
);
src
+=
sizeof
(
__m128i
);
src
+=
sizeof
(
__m128i
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment