Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divsufsort made header-only #45

Merged
merged 4 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "external/googletest"]
path = external/googletest
url = https://chromium.googlesource.com/external/googletest
[submodule "external/libdivsufsort"]
path = external/libdivsufsort
url = https://github.com/simongog/libdivsufsort.git
3 changes: 0 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ file(GLOB example_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../include
${CMAKE_CURRENT_BINARY_DIR}/../external/libdivsufsort/include
)

link_libraries(divsufsort divsufsort64)

foreach(example_source ${example_sources})
get_filename_component(example_name ${example_source} NAME_WE)
add_executable(${example_name} EXCLUDE_FROM_ALL ${example_name}.cpp)
Expand Down
16 changes: 0 additions & 16 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@ if(NOT GIT_FOUND)
message(WARNING "git not found. Cloning of submodules will not work.")
endif()


## Add libdivsufsort
set(divsufsort_cmake_file ${CMAKE_CURRENT_LIST_DIR}/libdivsufsort/CMakeLists.txt)
if(NOT EXISTS ${divsufsort_cmake_file})
EXECUTE_PROCESS(COMMAND git submodule update --init external/libdivsufsort
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..
OUTPUT_QUIET
)
endif(NOT EXISTS ${divsufsort_cmake_file})

set(BUILD_SHARED_LIBS OFF CACHE BOOL "Do not build a shared library for libdivsufsort")
set(BUILD_EXAMPLES OFF CACHE BOOL "Do not build libdivsufsort example")
set(BUILD_DIVSUFSORT64 ON CACHE BOOL "Build libdivsufsort in 64-bits mode")

add_subdirectory(libdivsufsort)

## Add gtest
set(gtest_dir ${CMAKE_CURRENT_LIST_DIR}/googletest)
set(gtest_file ${gtest_dir}/CMakeLists.txt)
Expand Down
1 change: 0 additions & 1 deletion external/libdivsufsort
Submodule libdivsufsort deleted from 22e6b2
7 changes: 3 additions & 4 deletions include/sdsl/construct_sa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "config.hpp"
#include "int_vector.hpp"

#include "divsufsort.h"
#include "divsufsort64.h"
#include "divsufsort.hpp"

#include "qsufsort.hpp"

Expand Down Expand Up @@ -94,7 +93,7 @@ void calculate_sa(const unsigned char* c, typename t_int_vec::size_type len, t_i
if (32 == t_width or (0 == t_width and 32 >= sa_width)) {
sa.width(32);
sa.resize(len);
divsufsort(c, (int32_t*)sa.data(), len);
divsufsort(c, (int32_t*)sa.data(), (int32_t)len);
// copy integers back to the right positions
if (sa_width != 32) {
for (size_type i = 0, p = 0; i < len; ++i, p += sa_width) {
Expand All @@ -108,7 +107,7 @@ void calculate_sa(const unsigned char* c, typename t_int_vec::size_type len, t_i
throw std::logic_error("width of int_vector is to small for the text!!!");
}
int_vector<> sufarray(len, 0, 32);
divsufsort(c, (int32_t*)sufarray.data(), len);
divsufsort(c, (int32_t*)sufarray.data(), (int32_t)len);
sa.resize(len);
for (size_type i = 0; i < len; ++i) {
sa[i] = sufarray[i];
Expand Down
Loading