diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-06-04 14:05:20 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-06-04 14:05:20 +0000 |
commit | 595b993ef6d5a826ee0c927a0f375da634175842 (patch) | |
tree | 91008274f002a2208ec949828e65f1cd5acd8053 /searchlib | |
parent | 87aa17fedb7d162e959ce09784030748417905bb (diff) |
Remove expgolomb app. It was a test app that has effectively
been replaced by expgolomb unit test.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | searchlib/src/apps/expgolomb/.gitignore | 3 | ||||
-rw-r--r-- | searchlib/src/apps/expgolomb/CMakeLists.txt | 9 | ||||
-rw-r--r-- | searchlib/src/apps/expgolomb/expgolomb.cpp | 168 |
4 files changed, 0 insertions, 181 deletions
diff --git a/searchlib/CMakeLists.txt b/searchlib/CMakeLists.txt index c15ed681d8f..ec912bf90ab 100644 --- a/searchlib/CMakeLists.txt +++ b/searchlib/CMakeLists.txt @@ -58,7 +58,6 @@ vespa_define_module( APPS src/apps/docstore - src/apps/expgolomb src/apps/fileheaderinspect src/apps/loadattribute src/apps/tests diff --git a/searchlib/src/apps/expgolomb/.gitignore b/searchlib/src/apps/expgolomb/.gitignore deleted file mode 100644 index 0886ab154a2..00000000000 --- a/searchlib/src/apps/expgolomb/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.depend -Makefile -expgolomb diff --git a/searchlib/src/apps/expgolomb/CMakeLists.txt b/searchlib/src/apps/expgolomb/CMakeLists.txt deleted file mode 100644 index 230718907dd..00000000000 --- a/searchlib/src/apps/expgolomb/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchlib_expgolomb_app - SOURCES - expgolomb.cpp - OUTPUT_NAME expgolomb - INSTALL bin - DEPENDS - searchlib -) diff --git a/searchlib/src/apps/expgolomb/expgolomb.cpp b/searchlib/src/apps/expgolomb/expgolomb.cpp deleted file mode 100644 index 81aa566305c..00000000000 --- a/searchlib/src/apps/expgolomb/expgolomb.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/fastos/app.h> -#include <vespa/searchlib/bitcompression/compression.h> -#include <vector> - -class ExpGolombApp : public FastOS_Application -{ - void usage(); - int testExpGolomb64(int kValue); - int testExpGolomb64le(int kValue); - int Main() override; -}; - - - -void -ExpGolombApp::usage() -{ - printf("Usage: expgolomb testeg64 <kValue>]\n"); - fflush(stdout); -} - - -int -ExpGolombApp::testExpGolomb64(int kValue) -{ - std::vector<uint64_t> myrand; - for (int i = 0; i < 10000; ++i) { - uint64_t rval = rand(); - rval <<= 30; - rval |= rand(); - myrand.push_back(rval); - } - for (int i = 0; i < 10000; ++i) { - uint64_t rval = rand(); - rval <<= 30; - rval |= rand(); - uint32_t bits = (rand() & 63); - rval &= ((UINT64_C(1) << bits) - 1); - myrand.push_back(rval); - } - typedef search::bitcompression::EncodeContext64BE EC; - - EC e; - search::ComprFileWriteContext wc(e); - wc.allocComprBuf(32768, 32768); - e.setupWrite(wc); - - int rsize = myrand.size(); - for (int i = 0; i < rsize; ++i) { - e.encodeExpGolomb(myrand[i], kValue); - if (e._valI >= e._valE) - wc.writeComprBuffer(false); - } - e.flush(); - - UC64_DECODECONTEXT(o); - unsigned int length; - uint64_t val64; - UC64BE_SETUPBITS_NS(o, static_cast<const uint64_t *>(wc._comprBuf), 0, EC); - - bool failure = false; - for (int i = 0; i < rsize; ++i) { - UC64BE_DECODEEXPGOLOMB(oVal, oCompr, oPreRead, oCacheInt, - kValue, EC); - if (val64 != myrand[i]) { - printf("FAILURE: TestExpGolomb64, val64=%" - PRIu64 ", myrand[%d]=%" PRIu64 "\n", - val64, i, myrand[i]); - failure = true; - } - } - if (!failure) - printf("SUCCESS: TestExpGolomb64\n"); - return failure ? 1 : 0; -} - -int -ExpGolombApp::testExpGolomb64le(int kValue) -{ - std::vector<uint64_t> myrand; - for (int i = 0; i < 10000; ++i) { - uint64_t rval = rand(); - rval <<= 30; - rval |= rand(); - myrand.push_back(rval); - } - for (int i = 0; i < 10000; ++i) { - uint64_t rval = rand(); - rval <<= 30; - rval |= rand(); - uint32_t bits = (rand() & 63); - rval &= ((UINT64_C(1) << bits) - 1); - myrand.push_back(rval); - } - typedef search::bitcompression::EncodeContext64LE EC; - - EC e; - search::ComprFileWriteContext wc(e); - wc.allocComprBuf(32768, 32768); - e.setupWrite(wc); - - int rsize = myrand.size(); - for (int i = 0; i < rsize; ++i) { - e.encodeExpGolomb(myrand[i], kValue); - if (e._valI >= e._valE) - wc.writeComprBuffer(false); - } - e.flush(); - - UC64_DECODECONTEXT(o); - unsigned int length; - uint64_t val64; - UC64LE_SETUPBITS_NS(o, static_cast<const uint64_t *>(wc._comprBuf), 0, EC); - - bool failure = false; - for (int i = 0; i < rsize; ++i) { - UC64LE_DECODEEXPGOLOMB(oVal, oCompr, oPreRead, oCacheInt, - kValue, EC); - if (val64 != myrand[i]) { - printf("FAILURE: TestExpGolomb64le, val64=%" - PRIu64 ", myrand[%d]=%" PRIu64 "\n", - val64, i, myrand[i]); - failure = true; - } - } - if (!failure) - printf("SUCCESS: TestExpGolomb64le\n"); - return failure ? 1 : 0; -} - - -int -ExpGolombApp::Main() -{ - printf("Hello world\n"); - if (_argc >= 2) { - if (strcmp(_argv[1], "testeg64") == 0) { - if (_argc < 3) { - fprintf(stderr, "Too few arguments\n"); - usage(); - return 1; - } - return testExpGolomb64(atoi(_argv[2])); - } else if (strcmp(_argv[1], "testeg64le") == 0) { - if (_argc < 3) { - fprintf(stderr, "Too few arguments\n"); - usage(); - return 1; - } - return testExpGolomb64le(atoi(_argv[2])); - } else { - fprintf(stderr, "Wrong arguments\n"); - usage(); - return 1; - } - } else { - fprintf(stderr, "Too few arguments\n"); - usage(); - return 1; - } - return 0; -} - -FASTOS_MAIN(ExpGolombApp); - - |