diff options
Diffstat (limited to 'research')
-rw-r--r-- | research/BUILD.libdivsufsort | 3 | ||||
-rw-r--r-- | research/WORKSPACE | 2 | ||||
-rw-r--r-- | research/brotli_decoder.c | 10 | ||||
-rw-r--r-- | research/deorummolae.cc | 8 | ||||
-rw-r--r-- | research/dictionary_generator.cc | 15 |
5 files changed, 34 insertions, 4 deletions
diff --git a/research/BUILD.libdivsufsort b/research/BUILD.libdivsufsort index a6deb5b..aeea923 100644 --- a/research/BUILD.libdivsufsort +++ b/research/BUILD.libdivsufsort @@ -38,7 +38,8 @@ genrule( srcs = ["include/config.h.cmake"], outs = ["include/config.h"], cmd = ("awk '{ " + - "gsub(/@HAVE_IO_H 1@/, \"HAVE_IO_H 0\"); " + + "gsub(/HAVE_IO_H 1/, \"HAVE_IO_H 0\"); " + + "gsub(/HAVE_STRINGS_H 1/, \"HAVE_STRINGS_H 0\"); " + commom_awk_replaces + "print; }' $(<) > $(@)"), ) diff --git a/research/WORKSPACE b/research/WORKSPACE index 358f87d..343c3bb 100644 --- a/research/WORKSPACE +++ b/research/WORKSPACE @@ -12,6 +12,7 @@ new_git_repository( build_file = "@//:BUILD.libdivsufsort", commit = "5f60d6f026c30fb4ac296f696b3c8b0eb71bd428", remote = "https://github.com/y-256/libdivsufsort", + shallow_since = "1445958113 +0900", ) new_git_repository( @@ -27,4 +28,5 @@ cc_library( """, commit = "ca7cb332011ec37a8436487f210f396b84bd8273", remote = "https://github.com/hillbig/esaxx", + shallow_since = "1391400691 +0900", ) diff --git a/research/brotli_decoder.c b/research/brotli_decoder.c index 4b0bc4a..3febcbd 100644 --- a/research/brotli_decoder.c +++ b/research/brotli_decoder.c @@ -6,7 +6,17 @@ #include <stdio.h> #include <stdlib.h> + +#if !defined(_WIN32) #include <unistd.h> +#else +#include <io.h> +#define fdopen _fdopen +#if !defined(__MINGW32__) +#define STDIN_FILENO _fileno(stdin) +#define STDOUT_FILENO _fileno(stdout) +#endif +#endif #include <brotli/decode.h> diff --git a/research/deorummolae.cc b/research/deorummolae.cc index f12acd1..23ac1aa 100644 --- a/research/deorummolae.cc +++ b/research/deorummolae.cc @@ -5,6 +5,10 @@ #include "third_party/esaxx/sais.hxx" +#if defined(_MSC_VER) +#include <intrin.h> /* __popcnt64 */ +#endif + /* Used for quick SA-entry to file mapping. Each file is padded to size that is a multiple of chunk size. */ #define CHUNK_SIZE 64 @@ -30,7 +34,11 @@ typedef uint32_t TextIdx; typedef int32_t TextSaIdx; static size_t popcount(uint64_t u) { +#if defined(_MSC_VER) + return static_cast<size_t>(__popcnt64(u)); +#else return static_cast<size_t>(__builtin_popcountll(u)); +#endif } /* Condense terminators and pad file entries. */ diff --git a/research/dictionary_generator.cc b/research/dictionary_generator.cc index 715723f..7df55ad 100644 --- a/research/dictionary_generator.cc +++ b/research/dictionary_generator.cc @@ -3,7 +3,9 @@ #include <cstdio> #include <cstring> #include <fstream> +#if !defined(_MSC_VER) #include <glob.h> +#endif #include <vector> #include "./deorummolae.h" @@ -268,14 +270,19 @@ int main(int argc, char const* argv[]) { } } + bool ok = true; +#if defined(_MSC_VER) + const char* resolved_path = argv[i]; +#else glob_t resolved_paths; memset(&resolved_paths, 0, sizeof(resolved_paths)); - bool ok = true; if (glob(argv[i], GLOB_TILDE, NULL, &resolved_paths) == 0) { for(size_t j = 0; j < resolved_paths.gl_pathc; ++j) { - std::string content = readFile(resolved_paths.gl_pathv[j]); + const char* resolved_path = resolved_paths.gl_pathv[j]; +#endif + std::string content = readFile(resolved_path); if (chunkLen == 0) { - paths.emplace_back(resolved_paths.gl_pathv[j]); + paths.emplace_back(resolved_path); data.insert(data.end(), content.begin(), content.end()); total += content.size(); sizes.push_back(content.size()); @@ -293,11 +300,13 @@ int main(int argc, char const* argv[]) { total += chunk.size(); sizes.push_back(chunk.size()); } +#if !defined(_MSC_VER) } } else { ok = false; } globfree(&resolved_paths); +#endif if (!ok) exit(1); } |