Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
vidjil
vidjil
Commits
7a3b20a7
Commit
7a3b20a7
authored
Jul 24, 2014
by
Mathieu Giraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/tools.cpp: spaced_int(), directly computes an int index from an int* sequence
parent
2c52a4e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
algo/core/tools.cpp
algo/core/tools.cpp
+28
-0
algo/core/tools.h
algo/core/tools.h
+1
-0
No files found.
algo/core/tools.cpp
View file @
7a3b20a7
...
...
@@ -49,6 +49,34 @@ string spaced(const string &input, const string &seed) {
int
spaced_int
(
int
*
input
,
const
string
&
seed
)
{
#ifdef NO_SPACED_SEEDS
return
input
;
#endif
int
j
=
0
;
// cout << input << endl << seed << endl ;
// assert(input.length() == seed.length()); // length is not equal, pointer
int
index_word
=
0
;
for
(
size_t
i
=
0
;
i
<
seed
.
length
();
i
++
)
if
(
seed
[
i
]
==
SEED_YES
)
index_word
=
(
index_word
<<
2
)
|
input
[
i
]
;
#ifdef DEBUG_SPACED
cout
<<
input
<<
" => |"
<<
index_word
<<
"|"
<<
endl
;
#endif
return
index_word
;
}
string
string_of_int
(
int
number
)
{
stringstream
ss
;
...
...
algo/core/tools.h
View file @
7a3b20a7
...
...
@@ -32,6 +32,7 @@ int seed_weight(const string &seed);
*/
string
spaced
(
const
string
&
input
,
const
string
&
seed
);
int
spaced_int
(
int
*
input
,
const
string
&
seed
);
/**
...
...
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