– The TU Dortmund Compression Framework
include/tudocomp/util.hpp File Reference
#include <memory>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
#include <iomanip>
#include <tudocomp/util/View.hpp>

Go to the source code of this file.


struct  tdc::msbf< int_t >
 Yields the position of the most significant bit for the template integer type. More...
struct  tdc::msbf< uint8_t >
 Specialization of msbf for 8-bit unsigned integers. More...
struct  tdc::msbf< uint16_t >
 Specialization of msbf for 16-bit unsigned integers. More...
struct  tdc::msbf< uint32_t >
 Specialization of msbf for 32-bit unsigned integers. More...
struct  tdc::msbf< uint64_t >
 Specialization of msbf for 64-bit unsigned integers. More...
class  tdc::MoveGuard


 Contains the text compression and encoding framework.


template<class T >
std::string tdc::vec_to_debug_string (const T &s, size_t indent=0)
 Builds the string representation of a vector of byte values, sorrounded by square brackets ([ and ]). More...
template<class T >
std::string tdc::arr_to_debug_string (const T *s, size_t length)
 Builds the string representation of an array of printable values, sorrounded by square brackets ([ and ]). More...
std::string tdc::byte_to_nice_ascii_char (uint64_t byte)
 Converts a byte value into its ASCII representation sorrounded by single quotes (') or its string representation. More...
template<class T >
std::string tdc::vec_as_lossy_string (const T &s, size_t start=0, char replacement='?')
 Converts a vector of bytes into a readable ASCII string, substituting non-ASCII symbols. More...
template<typename T >
std::string tdc::to_str (const T &v)
 Represent a value as a string. More...
void tdc::debug_print_uint64_t (uint64_t v)
bool tdc::parse_number_until_other (std::istream &inp, char &last, size_t &out)
 Reads digits from the input stream (0 to 9) until a non-digit character is reached and parses them as an integer. More...
constexpr uint_fast8_t tdc::bits_hi (uint64_t x)
 Computes the highest set bit in an integer variable. More...
constexpr uint_fast8_t tdc::bits_for (size_t n)
 Computes the number of bits required to store the given integer value. More...
constexpr size_t tdc::idiv_ceil (size_t a, size_t b)
 Performs an integer division with the result rounded up to the next integer. More...
constexpr uint_fast8_t tdc::bytes_for (size_t n)
 Computes the number of bytes needed to store the given integer value. More...
template<class T >
std::vector< T > tdc::cross (std::vector< std::vector< T >> &&vs, std::function< T(T, T &)> f)
 Creates the cross product of a set of elements given a product function. More...
std::vector< std::string > tdc::split_lines (const std::string &s)
 Splits the input string into lines (separated by \n). More...
std::string tdc::indent_lines (const std::string &s, size_t indent)
 Indents each line of a string (separated by \n) by the specified amount of spaces. More...
std::string tdc::make_table (const std::vector< std::string > &data, size_t cols, bool draw_grid=true)
 Renders the given dataset into an ASCII table. More...
template<class T >
void tdc::assert_permutation (const T &, size_t)
template<class T >
void tdc::assert_permutation_offset (const T &, size_t, size_t)
template<class T >
constexpr T tdc::round_up_div (T x, T y)
 Division with rounding up to the next integer. More...
template<class int_t >
int_t tdc::isqrt (int_t num)
template<typename T = int>
constexpr T tdc::shift_by (T value, int amount) noexcept
uint64_t tdc::zero_or_next_power_of_two (uint64_t x)