MTToolBox  0.2.10
Namespaces | Functions
util.hpp File Reference

Utility functions. More...

#include <iostream>
#include <iomanip>
#include <sstream>
#include <inttypes.h>
#include <stdint.h>
#include <stdexcept>
#include <NTL/GF2X.h>

Go to the source code of this file.

Namespaces

 MTToolBox
 name space for MTToolBox
 

Functions

static int MTToolBox::count_bit (uint16_t x)
 Counts number of 1s. More...
 
static int MTToolBox::count_bit (uint32_t x)
 Counts number of 1s. More...
 
static int MTToolBox::count_bit (uint64_t x)
 Counts number of 1s. More...
 
static uint32_t MTToolBox::reverse_bit (uint32_t x)
 Reverse bits. More...
 
static uint64_t MTToolBox::reverse_bit (uint64_t x)
 Counts number of 1s. More...
 
template<typename T >
int MTToolBox::bit_size ()
 Returns bit size of T. More...
 
static void MTToolBox::UNUSED_VARIABLE (void *x)
 Stop warning of unused variable. More...
 
template<typename T >
MTToolBox::floor2p (T n)
 Return greatest power of two not greater than n. More...
 
static void MTToolBox::print_binary (std::ostream &os, NTL::GF2X &poly, bool breakline=true)
 Outputs coefficients of poly to os. More...
 
template<typename T >
int MTToolBox::get_range (T input, int start, int end)
 Changes input to number between start and end. More...
 
template<typename T >
void MTToolBox::fill_table (T dist_tbl[], T src_tbl[], int size)
 Makes a fast and redundant lookup table from a tabale of GF(2) vectors. More...
 
static int MTToolBox::calc_1pos (uint16_t x)
 Returns the position of 1 which appears lowest (most right side) in x, where the position of MSB becomes zero. More...
 
static int MTToolBox::calc_1pos (uint32_t x)
 Returns the position of 1 which appears lowest (most right side) in x, where the position of MSB becomes zero. More...
 
static int MTToolBox::calc_1pos (uint64_t x)
 Returns the position of 1 which appears lowest (most right side) in x, where the position of MSB becomes zero. More...
 
static void MTToolBox::LCM (NTL::GF2X &lcm, const NTL::GF2X &x, const NTL::GF2X &y)
 Calculate the Least Common Multiple of x and y. More...
 
template<typename U >
static void MTToolBox::toGF2Vec (NTL::vec_GF2 &result, U value)
 convert unsigned integer to GF(2) vector MSB of unsigned integer becomes first element of the vector. More...
 
template<typename U >
MTToolBox::getOne ()
 return one of specified type More...
 
template<typename U >
void MTToolBox::setZero (U &x)
 set zero More...
 
template<typename U >
unsigned int MTToolBox::getBitOfPos (U bits, int pos)
 set zero More...
 
template<typename U >
void MTToolBox::setBitOfPos (U *bits, int pos, unsigned int b)
 set zero or 1 to specified bit of specified type variable. More...
 
template<typename U >
static U MTToolBox::fromGF2Vec (NTL::vec_GF2 &value)
 convert GF(2) vector to unsigned integer the first element of vector becomes the MSB of the result integer. More...
 
template<typename U >
bool MTToolBox::isZero (U x)
 check if varible is zero or not More...
 
template<typename U , typename V >
MTToolBox::convert (V x)
 convert to type U from type V More...
 

Detailed Description

Utility functions.

Author
Mutsuo Saito (Hiroshima University)
Makoto Matsumoto (Hiroshima University)

Copyright (C) 2013, 2016 Mutsuo Saito, Makoto Matsumoto and Hiroshima University. All rights reserved.

The 3-clause BSD License is applied to this software, see LICENSE.txt