aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authoryuta.256 <yuta.256@b7c3aa3b-274f-0410-ae0b-edc9d07c929d>2008-07-27 21:14:31 +0000
committeryuta.256 <yuta.256@b7c3aa3b-274f-0410-ae0b-edc9d07c929d>2008-07-27 21:14:31 +0000
commita844abd2925b6820947c8887e314a44435b884da (patch)
tree3f4538393d4db9075001ec8af99205812d197c09 /include
parentf6a102a6c865e0c593e3d296d11ad340a581711b (diff)
downloadplatform_external_libdivsufsort-a844abd2925b6820947c8887e314a44435b884da.tar.gz
platform_external_libdivsufsort-a844abd2925b6820947c8887e314a44435b884da.tar.bz2
platform_external_libdivsufsort-a844abd2925b6820947c8887e314a44435b884da.zip
Added 64-bit version of divsufsort.
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt43
-rw-r--r--include/divsufsort.h.cmake64
-rw-r--r--include/divsufsort_private.h23
3 files changed, 97 insertions, 33 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index ebbef28..6c40cb4 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -99,6 +99,40 @@ else(HAVE_INT32_T)
message(FATAL_ERROR "Cannot find 32-bit integer type")
endif(${SIZEOF_INT} STREQUAL "4")
endif(HAVE_INT32_T)
+# saint64_t (64bit)
+if(BUILD_DIVSUFSORT64)
+ check_type_size("int64_t" INT64_T)
+ if(HAVE_INT64_T)
+ set(SAINT64_TYPE "int64_t")
+ check_symbol_exists("PRId64" "inttypes.h" HAVE_PRID64)
+ if(HAVE_PRID64)
+ set(SAINT64_PRId "PRId64")
+ else(HAVE_PRID64)
+ set(SAINT64_PRId "\"ldd\"")
+ endif(HAVE_PRID64)
+ else(HAVE_INT64_T)
+ check_type_size("int" SIZEOF_INT)
+ check_type_size("long" SIZEOF_LONG)
+ check_type_size("long long" SIZEOF_LONG_LONG)
+ check_type_size("__int64" SIZEOF___INT64)
+ if(${SIZEOF_INT} STREQUAL "8")
+ set(SAINT64_TYPE "int")
+ set(SAINT64_PRId "\"d\"")
+ elseif(${SIZEOF_LONG} STREQUAL "8")
+ set(SAINT64_TYPE "long")
+ set(SAINT64_PRId "\"ld\"")
+ elseif(${SIZEOF_LONG_LONG} STREQUAL "8")
+ set(SAINT64_TYPE "long long")
+ set(SAINT64_PRId "\"lld\"")
+ elseif(${SIZEOF___INT64} STREQUAL "8")
+ set(SAINT64_TYPE "__int64")
+ set(SAINT64_PRId "\"I64d\"")
+ else(${SIZEOF_INT} STREQUAL "8")
+ message(SEND_ERROR "Cannot find 64-bit integer type")
+ set(BUILD_DIVSUFSORT64 OFF)
+ endif(${SIZEOF_INT} STREQUAL "8")
+ endif(HAVE_INT64_T)
+endif(BUILD_DIVSUFSORT64)
## generate divsufsort.h ##
set(DIVSUFSORT_IMPORT "")
@@ -111,9 +145,18 @@ if(BUILD_SHARED_LIBS)
set(DIVSUFSORT_EXPORT "__declspec(dllexport)")
endif(HAVE___DECLSPEC_DLLEXPORT_)
endif(BUILD_SHARED_LIBS)
+set(W64BIT "")
set(SAINDEX_TYPE "${SAINT32_TYPE}")
set(SAINDEX_PRId "${SAINT32_PRId}")
set(SAINT_PRId "${SAINT32_PRId}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/divsufsort.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/divsufsort.h" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/divsufsort.h" DESTINATION include)
+if(BUILD_DIVSUFSORT64)
+ set(W64BIT "64")
+ set(SAINDEX_TYPE "${SAINT64_TYPE}")
+ set(SAINDEX_PRId "${SAINT64_PRId}")
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/divsufsort.h.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" DESTINATION include)
+endif(BUILD_DIVSUFSORT64)
diff --git a/include/divsufsort.h.cmake b/include/divsufsort.h.cmake
index 45c7b04..a3b8968 100644
--- a/include/divsufsort.h.cmake
+++ b/include/divsufsort.h.cmake
@@ -1,5 +1,5 @@
/*
- * divsufsort.h for libdivsufsort
+ * divsufsort@W64BIT@.h for libdivsufsort@W64BIT@
* Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person
@@ -24,8 +24,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef _DIVSUFSORT_H
-#define _DIVSUFSORT_H 1
+#ifndef _DIVSUFSORT@W64BIT@_H
+#define _DIVSUFSORT@W64BIT@_H 1
#ifdef __cplusplus
extern "C" {
@@ -50,16 +50,16 @@ typedef @SAUCHAR_TYPE@ sauchar_t;
#define SAINT_T
typedef @SAINT32_TYPE@ saint_t;
#endif /* SAINT_T */
-#ifndef SAIDX_T
-#define SAIDX_T
-typedef @SAINDEX_TYPE@ saidx_t;
-#endif /* SAIDX_T */
+#ifndef SAIDX@W64BIT@_T
+#define SAIDX@W64BIT@_T
+typedef @SAINDEX_TYPE@ saidx@W64BIT@_t;
+#endif /* SAIDX@W64BIT@_T */
#ifndef PRIdSAINT_T
#define PRIdSAINT_T @SAINT_PRId@
#endif /* PRIdSAINT_T */
-#ifndef PRIdSAIDX_T
-#define PRIdSAIDX_T @SAINDEX_PRId@
-#endif /* PRIdSAIDX_T */
+#ifndef PRIdSAIDX@W64BIT@_T
+#define PRIdSAIDX@W64BIT@_T @SAINDEX_PRId@
+#endif /* PRIdSAIDX@W64BIT@_T */
/*- Prototypes -*/
@@ -73,7 +73,7 @@ typedef @SAINDEX_TYPE@ saidx_t;
*/
DIVSUFSORT_API
saint_t
-divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n);
+divsufsort@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t *SA, saidx@W64BIT@_t n);
/**
* Constructs the burrows-wheeler transformed string of a given string.
@@ -84,8 +84,8 @@ divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n);
* @return The primary index if no error occurred, -1 or -2 otherwise.
*/
DIVSUFSORT_API
-saidx_t
-divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n);
+saidx@W64BIT@_t
+divbwt@W64BIT@(const sauchar_t *T, sauchar_t *U, saidx@W64BIT@_t *A, saidx@W64BIT@_t n);
/**
* Returns the version of the divsufsort library.
@@ -93,54 +93,54 @@ divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n);
*/
DIVSUFSORT_API
const char *
-divsufsort_version(void);
+divsufsort@W64BIT@_version(void);
/* Burrows-Wheeler transform. */
DIVSUFSORT_API
saint_t
-bw_transform(const sauchar_t *T, sauchar_t *U,
- saidx_t *SA /* can NULL */,
- saidx_t n, saidx_t *idx);
+bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U,
+ saidx@W64BIT@_t *SA /* can NULL */,
+ saidx@W64BIT@_t n, saidx@W64BIT@_t *idx);
/* Inverse Burrows-Wheeler transform. */
DIVSUFSORT_API
saint_t
-inverse_bw_transform(const sauchar_t *T, sauchar_t *U,
- saidx_t *A /* can NULL */,
- saidx_t n, saidx_t idx);
+inverse_bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U,
+ saidx@W64BIT@_t *A /* can NULL */,
+ saidx@W64BIT@_t n, saidx@W64BIT@_t idx);
/**
* Checks the correctness of a given suffix array.
* @param T[0..n-1] The input string.
- * @param SA[0..n-1] The input suffix array.
+ * @param SA[0..n] The input suffix array.
* @param n The length of the given string.
* @param verbose The verbose mode.
* @return 0 if no error occurred.
*/
DIVSUFSORT_API
saint_t
-sufcheck(const sauchar_t *T, const saidx_t *SA, saidx_t n, saint_t verbose);
+sufcheck@W64BIT@(const sauchar_t *T, const saidx@W64BIT@_t *SA, saidx@W64BIT@_t n, saint_t verbose);
/* Search for the pattern P in the string T. */
DIVSUFSORT_API
-saidx_t
-sa_search(const sauchar_t *T, saidx_t Tsize,
- const sauchar_t *P, saidx_t Psize,
- const saidx_t *SA, saidx_t SAsize,
- saidx_t *left);
+saidx@W64BIT@_t
+sa_search@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize,
+ const sauchar_t *P, saidx@W64BIT@_t Psize,
+ const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize,
+ saidx@W64BIT@_t *left);
/* Search for the character c in the string T. */
DIVSUFSORT_API
-saidx_t
-sa_simplesearch(const sauchar_t *T, saidx_t Tsize,
- const saidx_t *SA, saidx_t SAsize,
- saint_t c, saidx_t *left);
+saidx@W64BIT@_t
+sa_simplesearch@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize,
+ const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize,
+ saint_t c, saidx@W64BIT@_t *left);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
-#endif /* _DIVSUFSORT_H */
+#endif /* _DIVSUFSORT@W64BIT@_H */
diff --git a/include/divsufsort_private.h b/include/divsufsort_private.h
index c0ab5a6..7e261c1 100644
--- a/include/divsufsort_private.h
+++ b/include/divsufsort_private.h
@@ -58,7 +58,28 @@ extern "C" {
# include <stdint.h>
# endif
#endif
-#include "divsufsort.h"
+#if defined(BUILD_DIVSUFSORT64)
+# include "divsufsort64.h"
+# ifndef SAIDX_T
+# define SAIDX_T
+# define saidx_t saidx64_t
+# endif /* SAIDX_T */
+# ifndef PRIdSAIDX_T
+# define PRIdSAIDX_T PRIdSAIDX64_T
+# endif /* PRIdSAIDX_T */
+# define divsufsort divsufsort64
+# define divbwt divbwt64
+# define divsufsort_version divsufsort64_version
+# define bw_transform bw_transform64
+# define inverse_bw_transform inverse_bw_transform64
+# define sufcheck sufcheck64
+# define sa_search sa_search64
+# define sa_simplesearch sa_simplesearch64
+# define sssort sssort64
+# define trsort trsort64
+#else
+# include "divsufsort.h"
+#endif
/*- Constants -*/