projects
/
libjh.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cfe1939
)
string: fix – it should also still compile on SSE2 machines
author
Jann Horn
<jann@thejh.net>
Tue, 20 Aug 2013 19:33:41 +0000
(21:33 +0200)
committer
Jann Horn
<jann@thejh.net>
Tue, 20 Aug 2013 19:33:41 +0000
(21:33 +0200)
string.c
patch
|
blob
|
history
diff --git
a/string.c
b/string.c
index
76aa69e
..
7e6da4f
100644
(file)
--- a/
string.c
+++ b/
string.c
@@
-1,6
+1,10
@@
// Copyright (2013) Jann Horn <jann@thejh.net>
// This code is licensed under the AGPLv3.
// Copyright (2013) Jann Horn <jann@thejh.net>
// This code is licensed under the AGPLv3.
+#ifdef __SSE2__
+#include <emmintrin.h>
+#endif
+
#include <string.h>
HEADER #include <stdint.h>
#include <string.h>
HEADER #include <stdint.h>
@@
-31,7
+35,6
@@
PUBLIC_FN size_t count_char_occurences_in_buf(char *b, size_t bl, char c) {
size_t res = 0;
#ifdef __SSE2__
size_t res = 0;
#ifdef __SSE2__
- #include <emmintrin.h>
// do it the simple way until we get to the next 16-byte-aligned address
while ((((uint64_t)b)&0xf) && b<be) if (*(b++)==c) res++;
// do it the simple way until we get to the next 16-byte-aligned address
while ((((uint64_t)b)&0xf) && b<be) if (*(b++)==c) res++;
@@
-84,7
+87,6
@@
PUBLIC_FN int count_and_replace_char_occurences_in_buf(char *b, size_t bl, char
int res = 0;
#ifdef __SSE2__
int res = 0;
#ifdef __SSE2__
- #include <emmintrin.h>
// do it the simple way until we get to the next 16-byte-aligned address
while ((((uint64_t)b)&0xf) && b<be) if (*(b++)==c) res++;
// do it the simple way until we get to the next 16-byte-aligned address
while ((((uint64_t)b)&0xf) && b<be) if (*(b++)==c) res++;