build: remove buzstats tool

This commit is contained in:
Danny Robson 2019-04-23 08:19:47 +10:00
parent 4cc20526ce
commit e1d56395f6
2 changed files with 1 additions and 33 deletions

View File

@ -542,7 +542,7 @@ endif ()
############################################################################### ###############################################################################
foreach (tool buzstats cpuid poisson macro scratch) foreach (tool cpuid poisson macro scratch)
add_executable (util_${tool} tools/${tool}.cpp) add_executable (util_${tool} tools/${tool}.cpp)
set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool}) set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool})
target_link_libraries (util_${tool} cruft) target_link_libraries (util_${tool} cruft)

View File

@ -1,32 +0,0 @@
#include "hash/buzhash.hpp"
#include "io.hpp"
#include <iostream>
int main (int argc, char const **argv)
{
(void)argc;
cruft::mapped_file src (argv[1]);
cruft::view bytes (src);
static constexpr std::size_t BITS = 16;
std::vector<std::size_t> counts (BITS, 0);
static constexpr std::size_t WINDOW = 48;
cruft::hash::buzhash<u64> h (WINDOW, bytes);
for (auto const &val: bytes.consume (WINDOW)) {
auto const res = h (&val);
std::size_t mask = ~u64(0) >> (64 - BITS);
for (std::size_t i = 0; i < BITS; ++i) {
if ((res & mask) == 0)
counts[i]++;
mask >>= 1;
}
}
for (auto const &i: counts)
std::cout << i << '\n';
}