build: remove unnecessary includes

discovered with include-what-you-use
This commit is contained in:
Danny Robson 2016-10-11 23:47:57 +11:00
parent be6ca2e1d2
commit 9a798446b5
78 changed files with 352 additions and 430 deletions

View File

@ -17,9 +17,9 @@
#ifndef __UTIL_ADAPTER_HPP
#define __UTIL_ADAPTER_HPP
#include <array>
#include <cstddef>
#include <iterator>
#include <tuple>
namespace util { namespace adapter {
namespace container {

View File

@ -52,6 +52,4 @@ namespace util::alloc {
};
}
#include "./linear.hpp"
#endif

View File

@ -19,7 +19,7 @@
#include "../debug.hpp"
#include <stdexcept>
#include <new>
using util::alloc::null;

View File

@ -18,7 +18,6 @@
#define __UTIL_ALLOC_STACK_HPP
#include <cstddef>
#include <cstdint>
namespace util::alloc {

View File

@ -23,11 +23,9 @@
#include "./cast.hpp"
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <execinfo.h>
#include <algorithm>
#include <memory>

View File

@ -18,27 +18,29 @@
//-----------------------------------------------------------------------------
template <>
uint8_t
reverse (uint8_t value) {
static const uint8_t LOOKUP[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
namespace util {
template <>
uint8_t
reverse (uint8_t value) {
static const uint8_t LOOKUP[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
return LOOKUP[value];
return LOOKUP[value];
}
}

View File

@ -17,62 +17,63 @@
#ifndef __UTIL_BITWISE_HPP
#define __UTIL_BITWISE_HPP
#include <type_traits>
#include <cstdint>
#include "debug.hpp"
const uint8_t BITMASK_1BITS = 0x01;
const uint8_t BITMASK_2BITS = 0x03;
const uint8_t BITMASK_3BITS = 0x07;
const uint8_t BITMASK_4BITS = 0x0F;
const uint8_t BITMASK_5BITS = 0x1F;
const uint8_t BITMASK_6BITS = 0x3F;
const uint8_t BITMASK_7BITS = 0x7F;
const uint8_t BITMASK_8BITS = 0xFF;
namespace util {
const uint8_t BITMASK_1BITS = 0x01;
const uint8_t BITMASK_2BITS = 0x03;
const uint8_t BITMASK_3BITS = 0x07;
const uint8_t BITMASK_4BITS = 0x0F;
const uint8_t BITMASK_5BITS = 0x1F;
const uint8_t BITMASK_6BITS = 0x3F;
const uint8_t BITMASK_7BITS = 0x7F;
const uint8_t BITMASK_8BITS = 0xFF;
///////////////////////////////////////////////////////////////////////////////
template <typename T>
constexpr T
rotatel [[gnu::pure]] (const T value, size_t magnitude)
{
return (value << magnitude) | (value >> sizeof (value) * 8 - magnitude);
}
template <typename T>
constexpr T
rotater [[gnu::pure]] (const T value, size_t magnitude)
{
return (value >> magnitude) | (value << sizeof (value) * 8 - magnitude);
}
///////////////////////////////////////////////////////////////////////////////
// TODO: make constexpr for C++14
template <typename T>
T
reverse (T value) {
T out = value;
size_t bits = sizeof (value) * 8 - 1;
for (value >>= 1; value; value >>= 1) {
out <<= 1;
out |= value & 0x01;
--bits;
///////////////////////////////////////////////////////////////////////////
template <typename T>
constexpr T
rotatel [[gnu::pure]] (const T value, std::size_t magnitude)
{
return (value << magnitude) | (value >> sizeof (value) * 8 - magnitude);
}
out <<= bits;
return out;
}
template <typename T>
constexpr T
rotater [[gnu::pure]] (const T value, std::size_t magnitude)
{
return (value >> magnitude) | (value << sizeof (value) * 8 - magnitude);
}
///////////////////////////////////////////////////////////////////////////////
template <typename T>
constexpr T
popcount (std::enable_if_t<std::is_integral<T>::value,T> t)
{
return __builtin_popcount (t);
///////////////////////////////////////////////////////////////////////////
// TODO: make constexpr for C++14
template <typename T>
T
reverse (T value) {
T out = value;
std::size_t bits = sizeof (value) * 8 - 1;
for (value >>= 1; value; value >>= 1) {
out <<= 1;
out |= value & 0x01;
--bits;
}
out <<= bits;
return out;
}
///////////////////////////////////////////////////////////////////////////
template <typename T>
constexpr T
popcount (std::enable_if_t<std::is_integral<T>::value,T> t)
{
return __builtin_popcount (t);
}
}
#endif

View File

@ -20,7 +20,7 @@
#include <functional>
#include <memory>
#include <stdexcept>
#include <exception>
#include <string>
#include <tuple>
#include <vector>

View File

@ -19,7 +19,6 @@
#include "./debug.hpp"
#include "./range.hpp"
#include "./random.hpp"
#include "./stream.hpp"
#include <array>
#include <map>

View File

@ -273,7 +273,7 @@ ice::encrypt (const uint64_t _ptext) const
uint8_t pbytes[8];
};
pword = hton (_ptext);
pword = util::hton (_ptext);
uint32_t l, r;
@ -304,7 +304,7 @@ ice::encrypt (const uint64_t _ptext) const
l >>= 8u;
}
return hton (cword);
return util::hton (cword);
}
@ -320,7 +320,7 @@ ice::decrypt (const uint64_t _ctext) const
uint8_t cbytes[8];
};
cword = hton (_ctext);
cword = util::hton (_ctext);
uint32_t l, r;
@ -351,7 +351,7 @@ ice::decrypt (const uint64_t _ctext) const
l >>= 8;
}
return hton (pword);
return util::hton (pword);
}

View File

@ -17,7 +17,6 @@
#include "backtrace.hpp"
#include "debug.hpp"
#include "log.hpp"
#include "platform.hpp"
#include <cstdlib>
#include <iostream>

View File

@ -21,7 +21,6 @@
#include <unistd.h>
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>

View File

@ -22,88 +22,89 @@
#include <cstdint>
#include <type_traits>
//-----------------------------------------------------------------------------
// Uses the TIFF header values. Just because. Don't rely on this.
enum class endian : uint16_t {
BIG = 0x4D4D,
LITTLE = 0x4949,
};
//-----------------------------------------------------------------------------
template <typename T>
constexpr T
bswap (T);
//template <> constexpr int8_t bswap ( int8_t v) { return v; }
//template <> constexpr int16_t bswap (int16_t v) { return __builtin_bswap16 (v); }
//template <> constexpr int32_t bswap (int32_t v) { return __builtin_bswap32 (v); }
//template <> constexpr int64_t bswap (int64_t v) { return __builtin_bswap64 (v); }
template <> constexpr uint8_t bswap ( uint8_t v) { return v; }
template <> constexpr uint16_t bswap (uint16_t v) { return __builtin_bswap16 (v); }
template <> constexpr uint32_t bswap (uint32_t v) { return __builtin_bswap32 (v); }
template <> constexpr uint64_t bswap (uint64_t v) { return __builtin_bswap64 (v); }
//-----------------------------------------------------------------------------
template <typename T>
constexpr T
identity (T &&v) {
return v;
}
//-----------------------------------------------------------------------------
#if defined(WORDS_BIGENDIAN)
template <typename T> constexpr T hton (T v) { return v; }
template <typename T> constexpr T ntoh (T v) { return v; }
template <typename T> constexpr T htob (T v) { return v; }
template <typename T> constexpr T htol (T v) { return bswap (v); }
template <typename T> constexpr T btoh (T v) { return v; }
template <typename T> constexpr T ltoh (T v) { return bswap (v); }
#else
template <typename T> constexpr T hton (T v) { return bswap (v); }
template <typename T> constexpr T ntoh (T v) { return bswap (v); }
template <typename T> constexpr T htob (T v) { return bswap (v); }
template <typename T> constexpr T htol (T v) { return v; }
template <typename T> constexpr T btoh (T v) { return bswap (v); }
template <typename T> constexpr T ltoh (T v) { return v; }
#endif
//-----------------------------------------------------------------------------
struct from_endian {
explicit from_endian (endian _endian):
src (_endian)
{ ; }
namespace util {
//-------------------------------------------------------------------------
// Uses the TIFF header values. Just because. Don't rely on this.
enum class endian : uint16_t {
BIG = 0x4D4D,
LITTLE = 0x4949,
};
//-------------------------------------------------------------------------
template <typename T>
T operator() (const T v) const {
static_assert (std::is_integral<T>::value || std::is_enum<T>::value,
"endian conversion is only defined for integrals currently");
constexpr T
bswap (T);
union {
typename sized_type<T>::sint sint;
typename sized_type<T>::uint uint;
};
//template <> constexpr int8_t bswap ( int8_t v) { return v; }
//template <> constexpr int16_t bswap (int16_t v) { return __builtin_bswap16 (v); }
//template <> constexpr int32_t bswap (int32_t v) { return __builtin_bswap32 (v); }
//template <> constexpr int64_t bswap (int64_t v) { return __builtin_bswap64 (v); }
if (std::is_signed<T>::value)
sint = v;
else
uint = v;
template <> constexpr uint8_t bswap ( uint8_t v) { return v; }
template <> constexpr uint16_t bswap (uint16_t v) { return __builtin_bswap16 (v); }
template <> constexpr uint32_t bswap (uint32_t v) { return __builtin_bswap32 (v); }
template <> constexpr uint64_t bswap (uint64_t v) { return __builtin_bswap64 (v); }
uint = (src == endian::LITTLE) ? ltoh (uint) : btoh (uint);
if (std::is_signed<T>::value)
return T (sint);
else
return T (uint);
//-------------------------------------------------------------------------
template <typename T>
constexpr T
identity (T &&v) {
return v;
}
endian src;
};
//-------------------------------------------------------------------------
#if defined(WORDS_BIGENDIAN)
template <typename T> constexpr T hton (T v) { return v; }
template <typename T> constexpr T ntoh (T v) { return v; }
template <typename T> constexpr T htob (T v) { return v; }
template <typename T> constexpr T htol (T v) { return bswap (v); }
template <typename T> constexpr T btoh (T v) { return v; }
template <typename T> constexpr T ltoh (T v) { return bswap (v); }
#else
template <typename T> constexpr T hton (T v) { return bswap (v); }
template <typename T> constexpr T ntoh (T v) { return bswap (v); }
template <typename T> constexpr T htob (T v) { return bswap (v); }
template <typename T> constexpr T htol (T v) { return v; }
template <typename T> constexpr T btoh (T v) { return bswap (v); }
template <typename T> constexpr T ltoh (T v) { return v; }
#endif
//-------------------------------------------------------------------------
struct from_endian {
explicit from_endian (endian _endian):
src (_endian)
{ ; }
template <typename T>
T operator() (const T v) const {
static_assert (std::is_integral<T>::value || std::is_enum<T>::value,
"endian conversion is only defined for integrals currently");
union {
typename sized_type<T>::sint sint;
typename sized_type<T>::uint uint;
};
if (std::is_signed<T>::value)
sint = v;
else
uint = v;
uint = (src == endian::LITTLE) ? ltoh (uint) : btoh (uint);
if (std::is_signed<T>::value)
return T (sint);
else
return T (uint);
}
endian src;
};
}
#endif

View File

@ -15,10 +15,9 @@
*/
#include "./except.hpp"
#include "./debug.hpp"
#include "./platform.hpp"
#include "./cast.hpp"
#include "./types.hpp"
#include <cstring>
#include <cerrno>

View File

@ -18,7 +18,6 @@
#include "./debug.hpp"
#include "./maths.hpp"
#include "./stream.hpp"
#include <algorithm>
#include <numeric>

View File

@ -17,7 +17,7 @@
#ifndef __UTIL_EXTENT_HPP
#define __UTIL_EXTENT_HPP
#include "coord.hpp"
#include "coord/base.hpp"
#include "vector.hpp"
#include "point.hpp"

View File

@ -18,10 +18,9 @@
#include "maths.hpp"
#include <cmath>
using namespace util;
///////////////////////////////////////////////////////////////////////////////
// Constructors
template <typename T, unsigned I, unsigned E>

View File

@ -19,7 +19,6 @@
#include "types/bits.hpp"
#include <cstdint>
#include <ostream>
namespace util {

View File

@ -19,6 +19,8 @@
#include <cmath>
using util::ieee_float;
///////////////////////////////////////////////////////////////////////////////
template <unsigned int E, unsigned int S>
@ -155,6 +157,6 @@ ieee_float<E, S>::almost_equal (floating_t _a,
///////////////////////////////////////////////////////////////////////////////
template class ieee_float< 5, 10>; // ieee_half
template class ieee_float< 8, 23>; // ieee_single;
template class ieee_float<11, 52>; // ieee_double;
template class util::ieee_float< 5, 10>; // ieee_half
template class util::ieee_float< 8, 23>; // ieee_single;
template class util::ieee_float<11, 52>; // ieee_double;

103
float.hpp
View File

@ -21,64 +21,65 @@
///////////////////////////////////////////////////////////////////////////////
template <unsigned int EXPONENT, unsigned int SIGNIFICAND>
class ieee_float
{
public:
static const unsigned int EXPONENT_BITS = EXPONENT;
static const unsigned int SIGNIFICAND_BITS = SIGNIFICAND;
static const unsigned int TOTAL_BITS = 1 + EXPONENT + SIGNIFICAND;
namespace util {
template <unsigned int EXPONENT, unsigned int SIGNIFICAND>
class ieee_float
{
public:
static const unsigned int EXPONENT_BITS = EXPONENT;
static const unsigned int SIGNIFICAND_BITS = SIGNIFICAND;
static const unsigned int TOTAL_BITS = 1 + EXPONENT + SIGNIFICAND;
static const unsigned int BIAS = (1 << (EXPONENT - 1)) - 1;
static const unsigned int BIAS = (1 << (EXPONENT - 1)) - 1;
typedef typename bits_type<TOTAL_BITS>::sint sint_t;
typedef typename bits_type<TOTAL_BITS>::uint uint_t;
typedef typename bits_type<TOTAL_BITS>::floating floating_t;
typedef typename bits_type<TOTAL_BITS>::sint sint_t;
typedef typename bits_type<TOTAL_BITS>::uint uint_t;
typedef typename bits_type<TOTAL_BITS>::floating floating_t;
protected:
union {
uint_t m_bits;
floating_t m_floating;
protected:
union {
uint_t m_bits;
floating_t m_floating;
struct {
uint_t sign : 1;
uint_t exponent : EXPONENT;
uint_t significand : SIGNIFICAND;
} m_components;
struct {
uint_t sign : 1;
uint_t exponent : EXPONENT;
uint_t significand : SIGNIFICAND;
} m_components;
};
public:
ieee_float (void);
ieee_float (floating_t _floating);
ieee_float (const ieee_float &rhs);
static unsigned int bias (void)
{ return BIAS; }
void set_bits (uint_t _bits) { m_bits = _bits; }
uint_t bits (void) const { return m_bits; }
bool negative (void) const { return m_components.sign; }
void negate (void) { m_components.sign ^= m_components.sign; }
bool is_zero (void) const;
bool is_subnormal (void) const;
bool is_inifinity (void) const;
bool is_nan (void) const;
bool operator== (floating_t) const;
static bool almost_equal (floating_t, floating_t);
static bool almost_equal (floating_t, floating_t, unsigned ulps);
};
public:
ieee_float (void);
ieee_float (floating_t _floating);
ieee_float (const ieee_float &rhs);
static unsigned int bias (void)
{ return BIAS; }
void set_bits (uint_t _bits) { m_bits = _bits; }
uint_t bits (void) const { return m_bits; }
bool negative (void) const { return m_components.sign; }
void negate (void) { m_components.sign ^= m_components.sign; }
bool is_zero (void) const;
bool is_subnormal (void) const;
bool is_inifinity (void) const;
bool is_nan (void) const;
bool operator== (floating_t) const;
static bool almost_equal (floating_t, floating_t);
static bool almost_equal (floating_t, floating_t, unsigned ulps);
};
typedef ieee_float< 5, 10> ieee_half;
typedef ieee_float< 8, 23> ieee_single;
typedef ieee_float<11, 52> ieee_double;
typedef ieee_float< 5, 10> ieee_half;
typedef ieee_float< 8, 23> ieee_single;
typedef ieee_float<11, 52> ieee_double;
static_assert (sizeof(ieee_half ) == 2, "ieee_half must be 2 bytes");
static_assert (sizeof(ieee_single ) == 4, "ieee_single must be 4 bytes");
static_assert (sizeof(ieee_double ) == 8, "ieee_double must be 8 bytes");
static_assert (sizeof(ieee_half ) == 2, "ieee_half must be 2 bytes");
static_assert (sizeof(ieee_single ) == 4, "ieee_single must be 4 bytes");
static_assert (sizeof(ieee_double ) == 8, "ieee_double must be 8 bytes");
}
#endif // __FLOAT_HPP

View File

@ -18,6 +18,7 @@
#include "./aabb.hpp"
#include "./iostream.hpp"
#include "../coord/iostream.hpp"
#include "../debug.hpp"
using util::geom::AABB;

View File

@ -20,7 +20,6 @@
#include "../point.hpp"
#include "../extent.hpp"
#include "../coord/iostream.hpp"
#include <cstdint>

View File

@ -18,7 +18,7 @@
#include "./iostream.hpp"
#include "./ops.hpp"
#include "../coord/iostream.hpp"
#include "../debug.hpp"
using util::geom::ray;

View File

@ -23,8 +23,6 @@
#include "../vector.hpp"
#include "../point.hpp"
#include <ostream>
namespace util { namespace geom {
template <size_t S, typename T>
struct ray {

View File

@ -14,13 +14,12 @@
* Copyright 2011 Danny Robson <danny@nerdcruft.net>
*/
#include "guid.hpp"
#include "./guid.hpp"
#include "debug.hpp"
#include "endian.hpp"
#include "types.hpp"
#include "./debug.hpp"
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <sstream>
@ -36,7 +35,7 @@ guid::guid (uint32_t _data1,
data2 (_data2),
data3 (_data3)
{
std::copy (_data4, _data4 + elems (data4), data4);
std::copy (_data4, _data4 + std::size (data4), data4);
}
@ -66,7 +65,7 @@ guid::operator= (const guid &rhs) {
data1 = rhs.data1;
data2 = rhs.data2;
data3 = rhs.data3;
std::copy (rhs.data4 + 0, rhs.data4 + elems (rhs.data4), data4 + 0);
std::copy (rhs.data4 + 0, rhs.data4 + std::size (rhs.data4), data4 + 0);
return *this;
}
@ -133,7 +132,7 @@ guid::operator< (const guid &rhs) const {
if (data3 != rhs.data3)
return data3 < rhs.data3;
for (unsigned i = 0; i < elems (data4); ++i) {
for (unsigned i = 0; i < std::size (data4); ++i) {
if (data4[i] == rhs.data4[i])
return data4[i] < rhs.data4[i];
}

View File

@ -20,7 +20,6 @@
#include "./fletcher.hpp"
#include <cstdint>
#include <cstdlib>
///////////////////////////////////////////////////////////////////////////////

View File

@ -118,7 +118,7 @@ HMAC<T>::digest (void)
#include "md5.hpp"
#include "sha1.hpp"
namespace util { namespace hash {
namespace util::hash {
template class HMAC<MD5>;
template class HMAC<SHA1>;
} }
}

View File

@ -8,6 +8,7 @@
#include <cstdint>
#include <array>
#include <iostream>
#include <algorithm>
#if 0
#define FOR(i,n) for(i=0; i<n; ++i)
@ -236,7 +237,7 @@ permute_theta (uint64_t m_words[5][5])
for (unsigned x = 0; x < 5; ++x) {
// Compute the θ effect for a given column
D = C[(x+4)%5] ^ rotatel (C[(x+1)%5], 1);
D = C[(x+4)%5] ^ util::rotatel (C[(x+1)%5], 1);
// Add the θ effect to the whole column
for (unsigned y = 0; y < 5; ++y)
@ -248,30 +249,30 @@ permute_theta (uint64_t m_words[5][5])
void
permute_rho (uint64_t m_words[5][5])
{
m_words[0][1] = rotatel (m_words[0][1], 1);
m_words[0][2] = rotatel (m_words[0][2], 62);
m_words[0][3] = rotatel (m_words[0][3], 28);
m_words[0][4] = rotatel (m_words[0][4], 27);
m_words[1][0] = rotatel (m_words[1][0], 36);
m_words[1][1] = rotatel (m_words[1][1], 44);
m_words[1][2] = rotatel (m_words[1][2], 6);
m_words[1][3] = rotatel (m_words[1][3], 55);
m_words[1][4] = rotatel (m_words[1][4], 20);
m_words[2][0] = rotatel (m_words[2][0], 3);
m_words[2][1] = rotatel (m_words[2][1], 10);
m_words[2][2] = rotatel (m_words[2][2], 43);
m_words[2][3] = rotatel (m_words[2][3], 25);
m_words[2][4] = rotatel (m_words[2][4], 39);
m_words[3][0] = rotatel (m_words[3][0], 41);
m_words[3][1] = rotatel (m_words[3][1], 45);
m_words[3][2] = rotatel (m_words[3][2], 15);
m_words[3][3] = rotatel (m_words[3][3], 21);
m_words[3][4] = rotatel (m_words[3][4], 8);
m_words[4][0] = rotatel (m_words[4][0], 18);
m_words[4][1] = rotatel (m_words[4][1], 2);
m_words[4][2] = rotatel (m_words[4][2], 61);
m_words[4][3] = rotatel (m_words[4][3], 56);
m_words[4][4] = rotatel (m_words[4][4], 14);
m_words[0][1] = util::rotatel (m_words[0][1], 1);
m_words[0][2] = util::rotatel (m_words[0][2], 62);
m_words[0][3] = util::rotatel (m_words[0][3], 28);
m_words[0][4] = util::rotatel (m_words[0][4], 27);
m_words[1][0] = util::rotatel (m_words[1][0], 36);
m_words[1][1] = util::rotatel (m_words[1][1], 44);
m_words[1][2] = util::rotatel (m_words[1][2], 6);
m_words[1][3] = util::rotatel (m_words[1][3], 55);
m_words[1][4] = util::rotatel (m_words[1][4], 20);
m_words[2][0] = util::rotatel (m_words[2][0], 3);
m_words[2][1] = util::rotatel (m_words[2][1], 10);
m_words[2][2] = util::rotatel (m_words[2][2], 43);
m_words[2][3] = util::rotatel (m_words[2][3], 25);
m_words[2][4] = util::rotatel (m_words[2][4], 39);
m_words[3][0] = util::rotatel (m_words[3][0], 41);
m_words[3][1] = util::rotatel (m_words[3][1], 45);
m_words[3][2] = util::rotatel (m_words[3][2], 15);
m_words[3][3] = util::rotatel (m_words[3][3], 21);
m_words[3][4] = util::rotatel (m_words[3][4], 8);
m_words[4][0] = util::rotatel (m_words[4][0], 18);
m_words[4][1] = util::rotatel (m_words[4][1], 2);
m_words[4][2] = util::rotatel (m_words[4][2], 61);
m_words[4][3] = util::rotatel (m_words[4][3], 56);
m_words[4][4] = util::rotatel (m_words[4][4], 14);
return;
@ -279,7 +280,7 @@ permute_rho (uint64_t m_words[5][5])
//unsigned r = ((t+1)*(t+2)/2)%64;
unsigned r = ((i + 1) * (i + 2) / 2) % 64;
m_words[i/5][i%5] = rotatel (m_words[i/5][i%5], r);
m_words[i/5][i%5] = util::rotatel (m_words[i/5][i%5], r);
}
}
@ -344,7 +345,7 @@ void
keccak::permute (void)
{
for (size_t i = 0; i < m_bitrate/64; ++i)
m_words[i/5][i%5] = ltoh (m_words[i/5][i%5]);
m_words[i/5][i%5] = util::ltoh (m_words[i/5][i%5]);
lfsr86540 shift;
@ -369,7 +370,7 @@ keccak::permute (void)
// Swap current and state(x,y), and rotate
temp = m_words[y][x];
m_words[y][x] = rotatel (current, r);
m_words[y][x] = util::rotatel (current, r);
current = temp;
}
}
@ -404,8 +405,6 @@ that use the Keccak-f[1600] permutation.
================================================================
*/
#include <cstring>
void
keccak::update (

View File

@ -18,8 +18,6 @@
#include "../bitwise.hpp"
#include "../debug.hpp"
#include "../endian.hpp"
#include "../types.hpp"
#include <cstring>

View File

@ -17,6 +17,7 @@
#include "md5.hpp"
#include "../bitwise.hpp"
#include "../debug.hpp"
#include <cstring>

View File

@ -73,11 +73,11 @@ util::hash::murmur3::hash_32(const void *restrict key,
uint32_t k1 = *cursor;
k1 *= c1;
k1 = rotatel (k1, 15);
k1 = util::rotatel (k1, 15);
k1 *= c2;
h1 ^= k1;
h1 = rotatel (h1, 13);
h1 = util::rotatel (h1, 13);
h1 += 0;
h1 = h1 * 5 + 0xe6546b64;
}
@ -88,7 +88,7 @@ util::hash::murmur3::hash_32(const void *restrict key,
uint32_t k1 = 0 ^ murmur::tail (cursor, len);
k1 *= c1;
k1 = rotatel (k1, 15);
k1 = util::rotatel (k1, 15);
k1 *= c2;
h1 ^= k1;
}
@ -153,7 +153,7 @@ half_round (std::array<T,traits<T>::COMPONENTS> h,
auto i_ = (i + 1) % COMPONENTS;
k[i] *= CONSTANTS[i].c;
k[i] = rotatel (k[i], CONSTANTS[i].Ks);
k[i] = util::rotatel (k[i], CONSTANTS[i].Ks);
k[i] *= CONSTANTS[i_].c;
return h[i] ^= k[i];
@ -173,7 +173,7 @@ full_round (std::array<T,traits<T>::COMPONENTS> h,
h[i] = half_round (h, k, i);
auto i_ = (i + 1) % COMPONENTS;
h[i] = rotatel (h[i], CONSTANTS[i].Hs);
h[i] = util::rotatel (h[i], CONSTANTS[i].Hs);
h[i] += h[i_];
h[i] = h[i] * 5 + CONSTANTS[i].O;
}

View File

@ -21,11 +21,10 @@
#include "../bitwise.hpp"
#include <cstring>
#include <stdexcept>
using util::hash::RIPEMD;
///////////////////////////////////////////////////////////////////////////////
RIPEMD::RIPEMD()
{

View File

@ -19,11 +19,9 @@
#include "../bitwise.hpp"
#include "../debug.hpp"
#include "../endian.hpp"
#include "../types.hpp"
#include "../cast.hpp"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <limits>
#include <ostream>

View File

@ -85,9 +85,9 @@ Maj (uint32_t x, uint32_t y, uint32_t z) {
#define FUNC(NAME,r0,r1,r2) \
static constexpr uint32_t \
NAME (uint32_t x) { \
return rotater (x, (r0)) ^ \
rotater (x, (r1)) ^ \
rotater (x, (r2)); \
return util::rotater (x, (r0)) ^ \
util::rotater (x, (r1)) ^ \
util::rotater (x, (r2)); \
}
@ -101,8 +101,8 @@ FUNC(S1, 6, 11, 25)
#define FUNC(NAME,r0,r1,s) \
static constexpr \
uint32_t NAME (uint32_t x) { \
return rotater (x, (r0)) ^ \
rotater (x, (r1)) ^ \
return util::rotater (x, (r0)) ^ \
util::rotater (x, (r1)) ^ \
(x >> (s)); \
}

2
io.cpp
View File

@ -18,13 +18,11 @@
#include "debug.hpp"
#include "except.hpp"
#include "platform.hpp"
#include "cast.hpp"
#include <cstdio>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <experimental/filesystem>

5
io.hpp
View File

@ -17,16 +17,11 @@
#ifndef __UTIL_IO_HPP
#define __UTIL_IO_HPP
#include "types.hpp"
#include "platform.hpp"
#include "nocopy.hpp"
#include "posix/fd.hpp"
#include <sys/stat.h>
#include <cstdio>
#include <cstdint>
#include <memory>
#include <experimental/filesystem>
#ifdef PLATFORM_WIN32

View File

@ -20,9 +20,7 @@
#include "except.hpp"
#include "posix/fd.hpp"
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
using util::detail::posix::mapped_file;

View File

@ -20,8 +20,6 @@
#include "json/flat.hpp"
#include "json/except.hpp"
#include "debug.hpp"
#include "io.hpp"
#include "preprocessor.hpp"
#include <deque>

View File

@ -17,8 +17,8 @@
#ifndef __UTIL_JSON_FLAT_HPP
#define __UTIL_JSON_FLAT_HPP
#include <experimental/filesystem>
#include <ostream>
#include <vector>
#include "../view.hpp"

View File

@ -19,7 +19,6 @@
#include "./tree.hpp"
#include "./except.hpp"
#include "../debug.hpp"
#include "../io.hpp"
#include "../maths.hpp"

View File

@ -19,7 +19,6 @@
#include "./fwd.hpp"
#include <memory>
#include <experimental/filesystem>
namespace json { namespace schema {

View File

@ -20,7 +20,6 @@
#include "./except.hpp"
#include "./flat.hpp"
#include "../cast.hpp"
#include "../debug.hpp"
#include "../io.hpp"
#include "../maths.hpp"
@ -28,15 +27,7 @@
#include <algorithm>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <stdexcept>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
using json::tree::node;
using json::tree::object;

View File

@ -20,10 +20,8 @@
#include "debug.hpp"
#include "term.hpp"
#include "time.hpp"
#include "types.hpp"
#include "cast.hpp"
#include <array>
#include <cstring>
#include <ctime>
#include <iomanip>

View File

@ -16,11 +16,6 @@
#include "maths.hpp"
#include "debug.hpp"
#include "float.hpp"
#include <cmath>
#include <type_traits>

View File

@ -30,7 +30,6 @@
#include <limits>
#include <numeric>
#include <type_traits>
#include <utility>
///////////////////////////////////////////////////////////////////////////////

View File

@ -23,8 +23,6 @@
#include "../../raii.hpp"
#include "../../random.hpp"
#include <cstring>
#include <cstdio>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>

View File

@ -17,9 +17,7 @@
#include "./point.hpp"
#include "./debug.hpp"
#include "./maths.hpp"
#include <cmath>
#include <cstdlib>
using util::point;

View File

@ -17,12 +17,9 @@
#ifndef __UTIL_POINT_HPP
#define __UTIL_POINT_HPP
#include "extent.hpp"
#include "vector.hpp"
#include "coord.hpp"
#include <array>
#include <initializer_list>
#include <type_traits>
namespace util {

View File

@ -21,7 +21,6 @@
#include <limits>
#include <cmath>
#include <iostream>
static const size_t NEWTON_ITERATIONS = 1u;

View File

@ -17,7 +17,6 @@
#ifndef __UTIL_POSIX_DIR_HPP
#define __UTIL_POSIX_DIR_HPP
#include <sys/types.h>
#include <dirent.h>
#include <functional>

View File

@ -17,8 +17,6 @@
#ifndef __CRUFT_UTIL_POSIX_FD_HPP
#define __CRUFT_UTIL_POSIX_FD_HPP
#include <string>
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -18,10 +18,9 @@
#include "./quaternion.hpp"
#include "./debug.hpp"
#include "./maths.hpp"
#include "./vector.hpp"
#include <iostream>
#include <cmath>
//-----------------------------------------------------------------------------
using util::quaternion;

View File

@ -16,6 +16,8 @@
#include "lcg.hpp"
#include "../maths.hpp"
using util::rand::lcg;

View File

@ -17,7 +17,8 @@
#ifndef __UTIL_RAND_LCG_HPP
#define __UTIL_RAND_LCG_HPP
#include "../maths.hpp"
#include <cstdint>
#include <type_traits>
namespace util { namespace rand {

View File

@ -18,13 +18,9 @@
#include "./region.hpp"
#include "./debug.hpp"
#include "./cast.hpp"
#include "./coord/iostream.hpp"
#include <cmath>
#include <type_traits>
//-----------------------------------------------------------------------------
template <size_t S, typename T>

View File

@ -17,12 +17,10 @@
#ifndef __UTIL_SIGNAL_HPP
#define __UTIL_SIGNAL_HPP
#include "nocopy.hpp"
#include "types/traits.hpp"
#include <functional>
#include <list>
#include <type_traits>
namespace util {
namespace combine {

View File

@ -19,6 +19,7 @@
#endif
#include "debug.hpp"
#include "nocopy.hpp"
#include <algorithm>

View File

@ -16,7 +16,6 @@
#include "stats.hpp"
#include <cmath>
#include <limits>

View File

@ -16,8 +16,6 @@
#include "stringid.hpp"
#include "raii.hpp"
#include <stdexcept>
#include <mutex>

View File

@ -16,8 +16,6 @@
#include "tap.hpp"
#include "debug.hpp"
#include <iostream>
using util::TAP::logger;

View File

@ -18,8 +18,6 @@
#define __UTIL_TAP_HPP
#include <functional>
#include <vector>
#include <initializer_list>
namespace util { namespace TAP {
/// A simple TAP (Test Anything Protocol) test case output

View File

@ -6,33 +6,33 @@
static void
test_rotate (util::TAP::logger &tap)
{
tap.expect_eq (rotatel (uint8_t (0x0F), 0), 0x0Fu, "rotate-left u8");
tap.expect_eq (rotatel (uint8_t (0x0F), 4), 0xF0u, "rotate-left u8");
tap.expect_eq (rotatel (uint8_t (0xF0), 4), 0x0Fu, "rotate-left u8");
tap.expect_eq (rotatel (uint8_t (0x0F), 8), 0x0Fu, "rotate-left u8");
tap.expect_eq (util::rotatel (uint8_t (0x0F), 0), 0x0Fu, "rotate-left u8");
tap.expect_eq (util::rotatel (uint8_t (0x0F), 4), 0xF0u, "rotate-left u8");
tap.expect_eq (util::rotatel (uint8_t (0xF0), 4), 0x0Fu, "rotate-left u8");
tap.expect_eq (util::rotatel (uint8_t (0x0F), 8), 0x0Fu, "rotate-left u8");
tap.expect_eq (rotater (uint8_t (0x0F), 0), 0x0Fu, "rotate-right u8");
tap.expect_eq (rotater (uint8_t (0x0F), 4), 0xF0u, "rotate-right u8");
tap.expect_eq (rotater (uint8_t (0xF0), 4), 0x0Fu, "rotate-right u8");
tap.expect_eq (rotater (uint8_t (0x0F), 8), 0x0Fu, "rotate-right u8");
tap.expect_eq (util::rotater (uint8_t (0x0F), 0), 0x0Fu, "rotate-right u8");
tap.expect_eq (util::rotater (uint8_t (0x0F), 4), 0xF0u, "rotate-right u8");
tap.expect_eq (util::rotater (uint8_t (0xF0), 4), 0x0Fu, "rotate-right u8");
tap.expect_eq (util::rotater (uint8_t (0x0F), 8), 0x0Fu, "rotate-right u8");
tap.expect_eq (rotatel (uint16_t (0xABCD), 0), 0xABCDu, "rotate-left u16");
tap.expect_eq (rotatel (uint16_t (0xABCD), 4), 0xBCDAu, "rotate-left u16");
tap.expect_eq (rotatel (uint16_t (0xABCD), 8), 0xCDABu, "rotate-left u16");
tap.expect_eq (rotatel (uint16_t (0xABCD), 12), 0xDABCu, "rotate-left u16");
tap.expect_eq (rotatel (uint16_t (0xABCD), 16), 0xABCDu, "rotate-left u16");
tap.expect_eq (util::rotatel (uint16_t (0xABCD), 0), 0xABCDu, "rotate-left u16");
tap.expect_eq (util::rotatel (uint16_t (0xABCD), 4), 0xBCDAu, "rotate-left u16");
tap.expect_eq (util::rotatel (uint16_t (0xABCD), 8), 0xCDABu, "rotate-left u16");
tap.expect_eq (util::rotatel (uint16_t (0xABCD), 12), 0xDABCu, "rotate-left u16");
tap.expect_eq (util::rotatel (uint16_t (0xABCD), 16), 0xABCDu, "rotate-left u16");
tap.expect_eq (rotater (uint16_t (0xABCD), 0), 0xABCDu, "rotate-right u16");
tap.expect_eq (rotater (uint16_t (0xABCD), 4), 0xDABCu, "rotate-right u16");
tap.expect_eq (rotater (uint16_t (0xABCD), 8), 0xCDABu, "rotate-right u16");
tap.expect_eq (rotater (uint16_t (0xABCD), 12), 0xBCDAu, "rotate-right u16");
tap.expect_eq (rotater (uint16_t (0xABCD), 16), 0xABCDu, "rotate-right u16");
tap.expect_eq (util::rotater (uint16_t (0xABCD), 0), 0xABCDu, "rotate-right u16");
tap.expect_eq (util::rotater (uint16_t (0xABCD), 4), 0xDABCu, "rotate-right u16");
tap.expect_eq (util::rotater (uint16_t (0xABCD), 8), 0xCDABu, "rotate-right u16");
tap.expect_eq (util::rotater (uint16_t (0xABCD), 12), 0xBCDAu, "rotate-right u16");
tap.expect_eq (util::rotater (uint16_t (0xABCD), 16), 0xABCDu, "rotate-right u16");
tap.expect_eq (rotatel (uint32_t (0x12345670), 12), 0x45670123u, "rotate-left u32");
tap.expect_eq (rotater (uint32_t (0x12345670), 12), 0x67012345u, "rotate-right u32");
tap.expect_eq (util::rotatel (uint32_t (0x12345670), 12), 0x45670123u, "rotate-left u32");
tap.expect_eq (util::rotater (uint32_t (0x12345670), 12), 0x67012345u, "rotate-right u32");
tap.expect_eq (rotatel (uint64_t (0x1234567890ABCDEF), 12), 0x4567890ABCDEF123u, "rotate-left u64");
tap.expect_eq (rotater (uint64_t (0x1234567890ABCDEF), 12), 0xDEF1234567890ABCu, "rotate-right u64");
tap.expect_eq (util::rotatel (uint64_t (0x1234567890ABCDEF), 12), 0x4567890ABCDEF123u, "rotate-left u64");
tap.expect_eq (util::rotater (uint64_t (0x1234567890ABCDEF), 12), 0xDEF1234567890ABCu, "rotate-right u64");
}
@ -42,8 +42,8 @@ test_reverse (util::TAP::logger &tap)
{
size_t matches = 0;
for (unsigned i = 0; i < 256; ++i) {
auto first = reverse<uint8_t> (i);
auto last = reverse<uint8_t> (first);
auto first = util::reverse<uint8_t> (i);
auto last = util::reverse<uint8_t> (first);
if (last == i)
matches++;
}

View File

@ -2,6 +2,7 @@
#include "tap.hpp"
#include "types.hpp"
#include <vector>
int
main ()

View File

@ -28,7 +28,7 @@ main (int, char**)
for (const auto &t: TESTS) {
std::vector<uint64_t> k (t.key.cbegin (), t.key.cend ());
std::transform (k.cbegin (), k.cend (), k.begin (), hton<uint64_t>);
std::transform (k.cbegin (), k.cend (), k.begin (), util::hton<uint64_t>);
ice key (t.level, k.data (), k.data () + k.size ());

View File

@ -3,6 +3,7 @@
#include "tap.hpp"
#include "types.hpp"
#include <vector>
int
main ()

View File

@ -12,8 +12,8 @@ void
test_double (util::TAP::logger &tap)
{
struct sized_test {
ieee_double::uint_t bits;
double floating;
util::ieee_double::uint_t bits;
double floating;
};
sized_test tests[] = {
@ -35,7 +35,7 @@ test_double (util::TAP::logger &tap)
bool success = true;
for (unsigned int i = 0; i < elems (tests); ++i) {
ieee_double val;
util::ieee_double val;
val.set_bits (tests[i].bits);
success = success && util::exactly_equal (val, tests[i].floating);
@ -50,8 +50,8 @@ void
test_single (util::TAP::logger &tap)
{
struct sized_test {
ieee_single::uint_t bits;
float floating;
util::ieee_single::uint_t bits;
float floating;
};
sized_test tests[] = {
@ -71,7 +71,7 @@ test_single (util::TAP::logger &tap)
bool success = true;
for (unsigned int i = 0; i < elems (tests); ++i) {
ieee_single val;
util::ieee_single val;
val.set_bits (tests[i].bits);
success = success && util::exactly_equal (val, tests[i].floating);

View File

@ -3,6 +3,7 @@
#include "tap.hpp"
#include <iomanip>
#include <vector>
static constexpr

View File

@ -21,11 +21,11 @@ main (void)
uint16_t u16 = 0x1358;
uint32_t u32 = 0x12345678;
tap.expect_eq (htons (u16), hton (u16), "htons");
tap.expect_eq (htonl (u32), hton (u32), "htonl");
tap.expect_eq (htons (u16), util::hton (u16), "htons");
tap.expect_eq (htonl (u32), util::hton (u32), "htonl");
tap.expect_eq (ntohs (u16), hton (u16), "ntohs");
tap.expect_eq (ntohl (u32), hton (u32), "ntohl");
tap.expect_eq (ntohs (u16), util::hton (u16), "ntohs");
tap.expect_eq (ntohl (u32), util::hton (u32), "ntohl");
return tap.status ();
}

View File

@ -3,6 +3,8 @@
#include "tap.hpp"
#include <typeindex>
#include <vector>
template <typename T>
struct int_mapper

View File

@ -16,10 +16,7 @@
#include "./time.hpp"
#include "./debug.hpp"
#include "./log.hpp"
#include "./platform.hpp"
#include "./cast.hpp"
#include <chrono>

View File

@ -16,10 +16,6 @@
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <iterator>
#include <cstdlib>
#include <cstring>
@ -30,7 +26,6 @@
#include "hash/adler.hpp"
#include "hash/bsdsum.cpp"
#include "hash/crc.hpp"
#include "hash/fletcher.hpp"
#include "hash/md2.hpp"
#include "hash/md4.hpp"
#include "hash/md5.hpp"
@ -45,7 +40,6 @@ const char* NAMES[] = {
"adler32",
"bsdsum",
"crc32",
"fletcher"
"MD2",
"MD4",
"MD5",

View File

@ -21,8 +21,6 @@
#include <cstdlib>
#include <iostream>
#include <experimental/filesystem>
///////////////////////////////////////////////////////////////////////////////
enum {

View File

@ -16,9 +16,8 @@
#include "json/except.hpp"
#include "json/tree.hpp"
#include "json/schema.hpp"
#include "json/except.hpp"
#include "json/tree.hpp"
#include "io.hpp"

View File

@ -21,7 +21,6 @@
#include <iostream>
#include <cstdlib>
#include <experimental/filesystem>
enum {

View File

@ -22,7 +22,6 @@
#include <tuple>
#include <type_traits>
#include <functional>
namespace util { namespace tuple {

View File

@ -20,53 +20,54 @@
#include <cstdint>
#include <cstddef>
template <size_t BITS>
struct bits_type;
namespace util {
template <size_t BITS>
struct bits_type;
template <> struct bits_type< 8u> {
static const bool has_floating = false;
template <> struct bits_type< 8u> {
static const bool has_floating = false;
typedef uint8_t uint;
typedef int8_t sint;
typedef uint8_t floating;
};
typedef uint8_t uint;
typedef int8_t sint;
typedef uint8_t floating;
};
template <> struct bits_type<16u> {
static const bool has_floating = false;
template <> struct bits_type<16u> {
static const bool has_floating = false;
typedef uint16_t uint;
typedef int16_t sint;
typedef uint16_t floating;
};
typedef uint16_t uint;
typedef int16_t sint;
typedef uint16_t floating;
};
template <> struct bits_type<32u> {
static const bool has_floating = true;
template <> struct bits_type<32u> {
static const bool has_floating = true;
typedef uint32_t uint;
typedef int32_t sint;
typedef float floating;
};
typedef uint32_t uint;
typedef int32_t sint;
typedef float floating;
};
template <> struct bits_type<64u> {
static const bool has_floating = true;
template <> struct bits_type<64u> {
static const bool has_floating = true;
typedef uint64_t uint;
typedef int64_t sint;
typedef double floating;
};
typedef uint64_t uint;
typedef int64_t sint;
typedef double floating;
};
template <size_t BYTES>
struct bytes_type : public bits_type<BYTES * 8u>
{ };
template <size_t BYTES>
struct bytes_type : public bits_type<BYTES * 8u>
{ };
template <typename T>
struct sized_type : public bits_type<sizeof(T) * 8u>
{ };
template <typename T>
struct sized_type : public bits_type<sizeof(T) * 8u>
{ };
}
#endif

View File

@ -17,13 +17,11 @@
#include "vector.hpp"
#include "debug.hpp"
#include "maths.hpp"
#include "random.hpp"
#include <algorithm>
#include "json/tree.hpp"
#include <cmath>
#include <limits>
#include <numeric>
using util::vector;
using util::vector3f;

View File

@ -17,11 +17,8 @@
#ifndef __UTIL_VECTOR_HPP
#define __UTIL_VECTOR_HPP
#include "json/tree.hpp"
#include "coord.hpp"
#include <array>
#include <initializer_list>
#include "json/fwd.hpp"
namespace util {
template <size_t S, typename T>