Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gesa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
extractor
gesa
Commits
00e56266
Commit
00e56266
authored
Jan 11, 2018
by
jkvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added utility functions
parent
b832e295
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
src/utils.c
src/utils.c
+54
-0
No files found.
src/utils.c
0 → 100644
View file @
00e56266
#include <stdlib.h>
#include "../include/gesa.h"
int
GESA_calculate_lcp
(
GESA_char_t
const
*
const
string
,
size_t
const
length
,
GESA_index_t
const
*
const
sa
,
GESA_index_t
*
const
lcp
)
{
GESA_index_t
*
const
rank
=
malloc
(
length
*
sizeof
(
*
rank
));
if
(
rank
==
NULL
)
{
return
1
;
// memory allocation failed
}
// if
for
(
size_t
i
=
0
;
i
<
length
;
++
i
)
{
rank
[
sa
[
i
]]
=
i
;
}
// for
GESA_index_t
h
=
0
;
for
(
size_t
i
=
0
;
i
<
length
;
++
i
)
{
if
(
rank
[
i
]
>
0
)
{
GESA_index_t
const
j
=
sa
[
rank
[
i
]
-
1
];
while
((
size_t
)
i
+
h
<
length
&&
(
size_t
)
j
+
h
<
length
&&
string
[
i
+
h
]
==
string
[
j
+
h
])
{
h
+=
1
;
}
// while
lcp
[
rank
[
i
]]
=
h
;
if
(
h
>
0
)
{
h
-=
1
;
}
// if
}
// if
}
// for
free
(
rank
);
return
0
;
}
// GESA_calculate_lcp
int
GESA_calculate_childtab
(
GESA
const
*
const
gesa
,
GESA_index_t
*
const
childtab
)
{
static
size_t
const
STACK_SIZE
=
2048
;
GESA_index_t
stack
[
STACK_SIZE
];
}
// GESA_calculate_childtab
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