whitespace
This commit is contained in:
parent
2658b41ea1
commit
7ae57730f0
@ -6,7 +6,7 @@ using namespace std;
|
|||||||
|
|
||||||
|
|
||||||
debug::backtrace::backtrace (void):
|
debug::backtrace::backtrace (void):
|
||||||
m_frames (DEFAULT_DEPTH)
|
m_frames (DEFAULT_DEPTH)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,5 +66,5 @@ reverse (T value) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ unreachable (void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
unreachable (const std::string& what) {
|
unreachable (const std::string& what) {
|
||||||
panic (" Unreachable code executed: " + what);
|
panic (" Unreachable code executed: " + what);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,4 +79,4 @@ namespace util {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
1
exe.cpp
1
exe.cpp
@ -38,7 +38,6 @@ util::image_path (void) {
|
|||||||
// We can't use lstat to check the size of the link in proc, as Linux
|
// We can't use lstat to check the size of the link in proc, as Linux
|
||||||
// will return 0 for most entries under proc. Instead we've got to
|
// will return 0 for most entries under proc. Instead we've got to
|
||||||
// iterate for a correct size.
|
// iterate for a correct size.
|
||||||
|
|
||||||
std::vector<char> resolved (256);
|
std::vector<char> resolved (256);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
@ -19,7 +19,7 @@ ieee_float<E, S>::ieee_float (floating_t _floating):
|
|||||||
|
|
||||||
|
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
ieee_float<E, S>::ieee_float (const ieee_float &rhs):
|
ieee_float<E, S>::ieee_float (const ieee_float &rhs):
|
||||||
m_bits (rhs.m_bits)
|
m_bits (rhs.m_bits)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ ieee_float<E, S>::is_nan (void) const {
|
|||||||
|
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::operator==(floating_t _floating) const {
|
ieee_float<E, S>::operator==(floating_t _floating) const {
|
||||||
// TODO: This method really shouldn't be generated if there's no
|
// TODO: This method really shouldn't be generated if there's no
|
||||||
// representative native floating point type. But I'm sick of
|
// representative native floating point type. But I'm sick of
|
||||||
// C++'s template bullshit for tonight.
|
// C++'s template bullshit for tonight.
|
||||||
@ -79,7 +79,7 @@ ieee_float<E, S>::operator==(floating_t _floating) const {
|
|||||||
//template <unsigned int E, unsigned int S>
|
//template <unsigned int E, unsigned int S>
|
||||||
//bool
|
//bool
|
||||||
//ieee_float<E, S>::almost_equal (floating_t a,
|
//ieee_float<E, S>::almost_equal (floating_t a,
|
||||||
// floating_t b) {
|
// floating_t b) {
|
||||||
// // Static cast to avoid integer casting warnings when using uint16_t for half
|
// // Static cast to avoid integer casting warnings when using uint16_t for half
|
||||||
// static const floating_t epsilon = static_cast<floating_t> (0.001);
|
// static const floating_t epsilon = static_cast<floating_t> (0.001);
|
||||||
// const floating_t diff = static_cast<floating_t> (std::fabs (a - b));
|
// const floating_t diff = static_cast<floating_t> (std::fabs (a - b));
|
||||||
|
2
guid.cpp
2
guid.cpp
@ -196,7 +196,7 @@ operator>> (std::istream &is, guid &g) {
|
|||||||
g.data4[5] = data4 & 0xFF; data4 >>= 8u;
|
g.data4[5] = data4 & 0xFF; data4 >>= 8u;
|
||||||
g.data4[6] = data4 & 0xFF; data4 >>= 8u;
|
g.data4[6] = data4 & 0xFF; data4 >>= 8u;
|
||||||
g.data4[7] = data4 & 0xFF;
|
g.data4[7] = data4 & 0xFF;
|
||||||
|
|
||||||
if (braces)
|
if (braces)
|
||||||
is.get ();
|
is.get ();
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@ crc32 (const void *restrict, size_t) {
|
|||||||
case 2: bits |= static_cast<uint64_t>(data[1]) << 48U;
|
case 2: bits |= static_cast<uint64_t>(data[1]) << 48U;
|
||||||
case 1: bits |= static_cast<uint64_t>(data[0]) << 56U;
|
case 1: bits |= static_cast<uint64_t>(data[0]) << 56U;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < size; ++i) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
for (unsigned j = 0; j < 32; ++j) {
|
for (unsigned j = 0; j < 32; ++j) {
|
||||||
bool mix = bits 0x7000000000000000ULL;
|
bool mix = bits 0x7000000000000000ULL;
|
||||||
bits <<= 1;
|
bits <<= 1;
|
||||||
|
|
||||||
if (mix)
|
if (mix)
|
||||||
bits ^= POLYNOMIAL << 32;
|
bits ^= POLYNOMIAL << 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ MD2::transform (void) {
|
|||||||
for (size_t i = 0; i < 18; ++i) {
|
for (size_t i = 0; i < 18; ++i) {
|
||||||
for (size_t j = 0; j < 48; ++j)
|
for (size_t j = 0; j < 48; ++j)
|
||||||
t = X[j] = X[j] ^ S[t];
|
t = X[j] = X[j] ^ S[t];
|
||||||
|
|
||||||
t = (t + i) % 256;
|
t = (t + i) % 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ MD4::digest_t
|
|||||||
MD4::digest (void) const {
|
MD4::digest (void) const {
|
||||||
digest_t d;
|
digest_t d;
|
||||||
memcpy (d.data (), ABCD.data(), sizeof (ABCD));
|
memcpy (d.data (), ABCD.data(), sizeof (ABCD));
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,17 +130,17 @@ MD4::transform (void) {
|
|||||||
ROUND1(D,A,B,C, 1, 7);
|
ROUND1(D,A,B,C, 1, 7);
|
||||||
ROUND1(C,D,A,B, 2, 11);
|
ROUND1(C,D,A,B, 2, 11);
|
||||||
ROUND1(B,C,D,A, 3, 19);
|
ROUND1(B,C,D,A, 3, 19);
|
||||||
|
|
||||||
ROUND1(A,B,C,D, 4, 3);
|
ROUND1(A,B,C,D, 4, 3);
|
||||||
ROUND1(D,A,B,C, 5, 7);
|
ROUND1(D,A,B,C, 5, 7);
|
||||||
ROUND1(C,D,A,B, 6, 11);
|
ROUND1(C,D,A,B, 6, 11);
|
||||||
ROUND1(B,C,D,A, 7, 19);
|
ROUND1(B,C,D,A, 7, 19);
|
||||||
|
|
||||||
ROUND1(A,B,C,D, 8, 3);
|
ROUND1(A,B,C,D, 8, 3);
|
||||||
ROUND1(D,A,B,C, 9, 7);
|
ROUND1(D,A,B,C, 9, 7);
|
||||||
ROUND1(C,D,A,B, 10, 11);
|
ROUND1(C,D,A,B, 10, 11);
|
||||||
ROUND1(B,C,D,A, 11, 19);
|
ROUND1(B,C,D,A, 11, 19);
|
||||||
|
|
||||||
ROUND1(A,B,C,D, 12, 3);
|
ROUND1(A,B,C,D, 12, 3);
|
||||||
ROUND1(D,A,B,C, 13, 7);
|
ROUND1(D,A,B,C, 13, 7);
|
||||||
ROUND1(C,D,A,B, 14, 11);
|
ROUND1(C,D,A,B, 14, 11);
|
||||||
|
12
hash/md5.cpp
12
hash/md5.cpp
@ -39,7 +39,7 @@ G (uint32_t x, uint32_t y, uint32_t z)
|
|||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
H (uint32_t x, uint32_t y, uint32_t z)
|
H (uint32_t x, uint32_t y, uint32_t z)
|
||||||
{ return x ^ y ^ z; }
|
{ return x ^ y ^ z; }
|
||||||
|
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
@ -57,19 +57,19 @@ const std::array<uint32_t, 65> T = { {
|
|||||||
0xf57c0fafu, 0x4787c62au, 0xa8304613u, 0xfd469501u,
|
0xf57c0fafu, 0x4787c62au, 0xa8304613u, 0xfd469501u,
|
||||||
0x698098d8u, 0x8b44f7afu, 0xffff5bb1u, 0x895cd7beu,
|
0x698098d8u, 0x8b44f7afu, 0xffff5bb1u, 0x895cd7beu,
|
||||||
0x6b901122u, 0xfd987193u, 0xa679438eu, 0x49b40821u,
|
0x6b901122u, 0xfd987193u, 0xa679438eu, 0x49b40821u,
|
||||||
|
|
||||||
// Round 2
|
// Round 2
|
||||||
0xf61e2562u, 0xc040b340u, 0x265e5a51u, 0xe9b6c7aau,
|
0xf61e2562u, 0xc040b340u, 0x265e5a51u, 0xe9b6c7aau,
|
||||||
0xd62f105du, 0x02441453u, 0xd8a1e681u, 0xe7d3fbc8u,
|
0xd62f105du, 0x02441453u, 0xd8a1e681u, 0xe7d3fbc8u,
|
||||||
0x21e1cde6u, 0xc33707d6u, 0xf4d50d87u, 0x455a14edu,
|
0x21e1cde6u, 0xc33707d6u, 0xf4d50d87u, 0x455a14edu,
|
||||||
0xa9e3e905u, 0xfcefa3f8u, 0x676f02d9u, 0x8d2a4c8au,
|
0xa9e3e905u, 0xfcefa3f8u, 0x676f02d9u, 0x8d2a4c8au,
|
||||||
|
|
||||||
// Round 3
|
// Round 3
|
||||||
0xfffa3942u, 0x8771f681u, 0x6d9d6122u, 0xfde5380cu,
|
0xfffa3942u, 0x8771f681u, 0x6d9d6122u, 0xfde5380cu,
|
||||||
0xa4beea44u, 0x4bdecfa9u, 0xf6bb4b60u, 0xbebfbc70u,
|
0xa4beea44u, 0x4bdecfa9u, 0xf6bb4b60u, 0xbebfbc70u,
|
||||||
0x289b7ec6u, 0xeaa127fau, 0xd4ef3085u, 0x04881d05u,
|
0x289b7ec6u, 0xeaa127fau, 0xd4ef3085u, 0x04881d05u,
|
||||||
0xd9d4d039u, 0xe6db99e5u, 0x1fa27cf8u, 0xc4ac5665u,
|
0xd9d4d039u, 0xe6db99e5u, 0x1fa27cf8u, 0xc4ac5665u,
|
||||||
|
|
||||||
// Round 4
|
// Round 4
|
||||||
0xf4292244u, 0x432aff97u, 0xab9423a7u, 0xfc93a039u,
|
0xf4292244u, 0x432aff97u, 0xab9423a7u, 0xfc93a039u,
|
||||||
0x655b59c3u, 0x8f0ccc92u, 0xffeff47du, 0x85845dd1u,
|
0x655b59c3u, 0x8f0ccc92u, 0xffeff47du, 0x85845dd1u,
|
||||||
@ -243,12 +243,12 @@ MD5::transform (void) {
|
|||||||
ROUNDx(D,A,B,C, 8, 11, 34, H);
|
ROUNDx(D,A,B,C, 8, 11, 34, H);
|
||||||
ROUNDx(C,D,A,B, 11, 16, 35, H);
|
ROUNDx(C,D,A,B, 11, 16, 35, H);
|
||||||
ROUNDx(B,C,D,A, 14, 23, 36, H);
|
ROUNDx(B,C,D,A, 14, 23, 36, H);
|
||||||
|
|
||||||
ROUNDx(A,B,C,D, 1, 4, 37, H);
|
ROUNDx(A,B,C,D, 1, 4, 37, H);
|
||||||
ROUNDx(D,A,B,C, 4, 11, 38, H);
|
ROUNDx(D,A,B,C, 4, 11, 38, H);
|
||||||
ROUNDx(C,D,A,B, 7, 16, 39, H);
|
ROUNDx(C,D,A,B, 7, 16, 39, H);
|
||||||
ROUNDx(B,C,D,A, 10, 23, 40, H);
|
ROUNDx(B,C,D,A, 10, 23, 40, H);
|
||||||
|
|
||||||
ROUNDx(A,B,C,D, 13, 4, 41, H);
|
ROUNDx(A,B,C,D, 13, 4, 41, H);
|
||||||
ROUNDx(D,A,B,C, 0, 11, 42, H);
|
ROUNDx(D,A,B,C, 0, 11, 42, H);
|
||||||
ROUNDx(C,D,A,B, 3, 16, 43, H);
|
ROUNDx(C,D,A,B, 3, 16, 43, H);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of libgim
|
* This file is part of libgim
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
@ -110,7 +110,7 @@ RIPEMD::transform (void) {
|
|||||||
#define R2a(a,b,c,d,e,x,s) ROUND(f2,a,b,c,d,e,0x5A827999u,x,s)
|
#define R2a(a,b,c,d,e,x,s) ROUND(f2,a,b,c,d,e,0x5A827999u,x,s)
|
||||||
#define R3a(a,b,c,d,e,x,s) ROUND(f3,a,b,c,d,e,0x6ED9EBA1u,x,s)
|
#define R3a(a,b,c,d,e,x,s) ROUND(f3,a,b,c,d,e,0x6ED9EBA1u,x,s)
|
||||||
#define R4a(a,b,c,d,e,x,s) ROUND(f4,a,b,c,d,e,0x8F1BBCDCu,x,s)
|
#define R4a(a,b,c,d,e,x,s) ROUND(f4,a,b,c,d,e,0x8F1BBCDCu,x,s)
|
||||||
#define R5a(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0xA953FD4Eu,x,s)
|
#define R5a(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0xA953FD4Eu,x,s)
|
||||||
|
|
||||||
#define R1b(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0x50A28BE6u,x,s)
|
#define R1b(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0x50A28BE6u,x,s)
|
||||||
#define R2b(a,b,c,d,e,x,s) ROUND(f4,a,b,c,d,e,0x5C4DD124u,x,s)
|
#define R2b(a,b,c,d,e,x,s) ROUND(f4,a,b,c,d,e,0x5C4DD124u,x,s)
|
||||||
@ -236,7 +236,7 @@ RIPEMD::transform (void) {
|
|||||||
R1b(a2, b2, c2, d2, e2, 12, 6);
|
R1b(a2, b2, c2, d2, e2, 12, 6);
|
||||||
|
|
||||||
// Right round 2
|
// Right round 2
|
||||||
R2b(e2, a2, b2, c2, d2, 6, 9);
|
R2b(e2, a2, b2, c2, d2, 6, 9);
|
||||||
R2b(d2, e2, a2, b2, c2, 11, 13);
|
R2b(d2, e2, a2, b2, c2, 11, 13);
|
||||||
R2b(c2, d2, e2, a2, b2, 3, 15);
|
R2b(c2, d2, e2, a2, b2, 3, 15);
|
||||||
R2b(b2, c2, d2, e2, a2, 7, 7);
|
R2b(b2, c2, d2, e2, a2, 7, 7);
|
||||||
@ -351,7 +351,7 @@ RIPEMD::finish (void) {
|
|||||||
memset (d32, 0, sizeof (d32));
|
memset (d32, 0, sizeof (d32));
|
||||||
d32[14] = length & 0xFFFFFFFF;
|
d32[14] = length & 0xFFFFFFFF;
|
||||||
d32[15] = length >> 32u;
|
d32[15] = length >> 32u;
|
||||||
|
|
||||||
// Do the final update
|
// Do the final update
|
||||||
size_t offset = sizeof(d08) - remaining;
|
size_t offset = sizeof(d08) - remaining;
|
||||||
update (d08 + offset, remaining);
|
update (d08 + offset, remaining);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of libgim
|
* This file is part of libgim
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of libgim
|
* This file is part of libgim
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
@ -267,7 +267,7 @@ SHA256::process (void) {
|
|||||||
SHA256::digest_t
|
SHA256::digest_t
|
||||||
SHA256::digest (void) const {
|
SHA256::digest (void) const {
|
||||||
digest_t out;
|
digest_t out;
|
||||||
|
|
||||||
auto cursor = out.begin ();
|
auto cursor = out.begin ();
|
||||||
for (auto i: H) {
|
for (auto i: H) {
|
||||||
*cursor++ = (i >> 24) & 0xFF;
|
*cursor++ = (i >> 24) & 0xFF;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of libgim
|
* This file is part of libgim
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
@ -39,7 +39,6 @@ namespace util {
|
|||||||
std::array<uint32_t, 16> M;
|
std::array<uint32_t, 16> M;
|
||||||
std::array<uint8_t, 64> C;
|
std::array<uint8_t, 64> C;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
io.hpp
3
io.hpp
@ -38,7 +38,7 @@ namespace util {
|
|||||||
ACCESS_WRITE = 1 << 1,
|
ACCESS_WRITE = 1 << 1,
|
||||||
ACCESS_READWRITE = ACCESS_READ | ACCESS_WRITE
|
ACCESS_READWRITE = ACCESS_READ | ACCESS_WRITE
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Reads an entire file into memory. Caller frees the result. Guarantees a
|
/// Reads an entire file into memory. Caller frees the result. Guarantees a
|
||||||
/// null trailing byte.
|
/// null trailing byte.
|
||||||
std::unique_ptr<char []>
|
std::unique_ptr<char []>
|
||||||
@ -130,7 +130,6 @@ namespace util {
|
|||||||
|
|
||||||
void set_cwd (const boost::filesystem::path &);
|
void set_cwd (const boost::filesystem::path &);
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
class path_error : public std::runtime_error {
|
class path_error : public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
|
@ -50,7 +50,6 @@ namespace util {
|
|||||||
const uint8_t* cbegin (void) const;
|
const uint8_t* cbegin (void) const;
|
||||||
const uint8_t* cend (void) const;
|
const uint8_t* cend (void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} }
|
} }
|
||||||
|
|
||||||
typedef detail::posix::mapped_file mapped_file;
|
typedef detail::posix::mapped_file mapped_file;
|
||||||
|
2
ip.hpp
2
ip.hpp
@ -45,7 +45,7 @@ namespace ipv4 {
|
|||||||
static const ip ANY;
|
static const ip ANY;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef uint16_t port;
|
typedef uint16_t port;
|
||||||
typedef uint32_t mask;
|
typedef uint32_t mask;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class referencing_iterator {
|
|||||||
typedef typename Base::difference_type difference_type ;
|
typedef typename Base::difference_type difference_type ;
|
||||||
typedef value_type& reference ;
|
typedef value_type& reference ;
|
||||||
typedef value_type* pointer;
|
typedef value_type* pointer;
|
||||||
typedef typename Base::iterator_category iterator_category;
|
typedef typename Base::iterator_category iterator_category;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Base m_base;
|
Base m_base;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UTIL_JSON_EXCEPT_HPP
|
#ifndef __UTIL_JSON_EXCEPT_HPP
|
||||||
#define __UTIL_JSON_EXCEPT_HPP
|
#define __UTIL_JSON_EXCEPT_HPP
|
||||||
|
2
lerp.hpp
2
lerp.hpp
@ -27,4 +27,4 @@ namespace lerp {
|
|||||||
double trunc (double a, double b, double weight);
|
double trunc (double a, double b, double weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2
log.cpp
2
log.cpp
@ -116,7 +116,7 @@ util::detail::log (level_t level, boost::format &&format) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
static const boost::format LEVEL_FORMAT ("%s [%s] ");
|
static const boost::format LEVEL_FORMAT ("%s [%s] ");
|
||||||
|
|
||||||
static const size_t time_len = strlen("YYYY-mm-dd HHMMhSS") + 1;
|
static const size_t time_len = strlen("YYYY-mm-dd HHMMhSS") + 1;
|
||||||
std::string time_string (time_len - 1, '\0');
|
std::string time_string (time_len - 1, '\0');
|
||||||
time_t unix_time = time (nullptr);
|
time_t unix_time = time (nullptr);
|
||||||
|
2
log.hpp
2
log.hpp
@ -36,7 +36,7 @@ namespace util {
|
|||||||
ALERT, /** action must be taken immediately */
|
ALERT, /** action must be taken immediately */
|
||||||
CRITICAL, /** critical conditions */
|
CRITICAL, /** critical conditions */
|
||||||
ERROR, /** error conditions */
|
ERROR, /** error conditions */
|
||||||
WARNING,
|
WARNING,
|
||||||
WARN = WARNING, /** warning conditions */
|
WARN = WARNING, /** warning conditions */
|
||||||
NOTICE, /** normal but significant condition */
|
NOTICE, /** normal but significant condition */
|
||||||
INFORMATIONAL,
|
INFORMATIONAL,
|
||||||
|
@ -52,7 +52,7 @@ namespace maths {
|
|||||||
double * operator [] (unsigned int row);
|
double * operator [] (unsigned int row);
|
||||||
|
|
||||||
const double * data (void) const;
|
const double * data (void) const;
|
||||||
|
|
||||||
matrix& operator =(const matrix &rhs);
|
matrix& operator =(const matrix &rhs);
|
||||||
matrix operator * (double scalar) const;
|
matrix operator * (double scalar) const;
|
||||||
matrix& operator *=(double scalar);
|
matrix& operator *=(double scalar);
|
||||||
@ -65,7 +65,7 @@ namespace maths {
|
|||||||
bool operator ==(const matrix &rhs) const;
|
bool operator ==(const matrix &rhs) const;
|
||||||
|
|
||||||
//matrix transpose (void) const { ; }
|
//matrix transpose (void) const { ; }
|
||||||
|
|
||||||
size_t rows (void) const;
|
size_t rows (void) const;
|
||||||
size_t columns (void) const;
|
size_t columns (void) const;
|
||||||
size_t size (void) const;
|
size_t size (void) const;
|
||||||
@ -107,7 +107,7 @@ namespace maths {
|
|||||||
|
|
||||||
class not_invertible : public std::runtime_error {
|
class not_invertible : public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
not_invertible ():
|
not_invertible ():
|
||||||
std::runtime_error ("not_invertible")
|
std::runtime_error ("not_invertible")
|
||||||
{ ; }
|
{ ; }
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ vector::~vector (void)
|
|||||||
/* element accessors */
|
/* element accessors */
|
||||||
|
|
||||||
const double*
|
const double*
|
||||||
vector::data (void) const
|
vector::data (void) const
|
||||||
{ return &m_data[0]; }
|
{ return &m_data[0]; }
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ double vector::dot (const double *restrict A,
|
|||||||
|
|
||||||
vector vector::cross (const double *restrict A,
|
vector vector::cross (const double *restrict A,
|
||||||
const double *restrict B,
|
const double *restrict B,
|
||||||
unsigned int size) {
|
unsigned int size) {
|
||||||
CHECK_EQ (size, 3);
|
CHECK_EQ (size, 3);
|
||||||
(void)size;
|
(void)size;
|
||||||
return vector ({ A[1] * B[2] - A[2] * B[1],
|
return vector ({ A[1] * B[2] - A[2] * B[1],
|
||||||
|
@ -53,7 +53,7 @@ const char* inet_ntop(int af, const void* src, char* dst, int size){
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <domain D>
|
template <domain D>
|
||||||
typename address<D>::port_type
|
typename address<D>::port_type
|
||||||
address<D>::port (void) const
|
address<D>::port (void) const
|
||||||
{ return m_port; }
|
{ return m_port; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,5 +121,5 @@ net::error_code<CODE>::error_code (void):
|
|||||||
|
|
||||||
template <int CODE>
|
template <int CODE>
|
||||||
int
|
int
|
||||||
net::error_code<CODE>::code (void) const
|
net::error_code<CODE>::code (void) const
|
||||||
{ return CODE; }
|
{ return CODE; }
|
||||||
|
@ -61,7 +61,7 @@ namespace net {
|
|||||||
last_code (void);
|
last_code (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <int CODE>
|
template <int CODE>
|
||||||
class error_code : public error {
|
class error_code : public error {
|
||||||
public:
|
public:
|
||||||
|
@ -168,8 +168,8 @@ net::socket<D, type::STREAM>::send (const uint8_t *restrict data, size_t len) {
|
|||||||
|
|
||||||
for (size_t sent = 0; sent < len; ) {
|
for (size_t sent = 0; sent < len; ) {
|
||||||
ssize_t result = ::send (this->m_fd, static_cast<const void *>(data + sent), len - sent, 0);
|
ssize_t result = ::send (this->m_fd, static_cast<const void *>(data + sent), len - sent, 0);
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
net::error::throw_code ();
|
net::error::throw_code ();
|
||||||
|
|
||||||
sent += sign_cast<size_t> (result);
|
sent += sign_cast<size_t> (result);
|
||||||
|
@ -79,7 +79,7 @@ namespace net {
|
|||||||
|
|
||||||
|
|
||||||
/// Indicates the wire transmission protocol to use.
|
/// Indicates the wire transmission protocol to use.
|
||||||
///
|
///
|
||||||
/// This DOES NOT mean what you think it does! It is included for completeness sake, and unless
|
/// This DOES NOT mean what you think it does! It is included for completeness sake, and unless
|
||||||
/// you're doing something funky with the C API you really just want DEFAULT.
|
/// you're doing something funky with the C API you really just want DEFAULT.
|
||||||
/// Values retrieved from /etc/protocols
|
/// Values retrieved from /etc/protocols
|
||||||
|
@ -92,7 +92,7 @@ value<L>::bounds (void) const
|
|||||||
|
|
||||||
|
|
||||||
template <lerp_function L>
|
template <lerp_function L>
|
||||||
double
|
double
|
||||||
value<L>::eval (double x, double y) const {
|
value<L>::eval (double x, double y) const {
|
||||||
intmax_t x_int = static_cast<intmax_t> (x);
|
intmax_t x_int = static_cast<intmax_t> (x);
|
||||||
intmax_t y_int = static_cast<intmax_t> (y);
|
intmax_t y_int = static_cast<intmax_t> (y);
|
||||||
@ -146,7 +146,7 @@ gradient<L>::bounds (void) const
|
|||||||
|
|
||||||
|
|
||||||
template <lerp_function L>
|
template <lerp_function L>
|
||||||
double
|
double
|
||||||
gradient<L>::eval (double x, double y) const {
|
gradient<L>::eval (double x, double y) const {
|
||||||
intmax_t x_int = static_cast<intmax_t> (x);
|
intmax_t x_int = static_cast<intmax_t> (x);
|
||||||
intmax_t y_int = static_cast<intmax_t> (y);
|
intmax_t y_int = static_cast<intmax_t> (y);
|
||||||
|
@ -129,7 +129,7 @@ util::noise::musgrave<B>::eval (double x, double y) const {
|
|||||||
for (size_t i = 1; i < this->octaves; ++i) {
|
for (size_t i = 1; i < this->octaves; ++i) {
|
||||||
f *= 2.0;
|
f *= 2.0;
|
||||||
a *= this->lacunarity;
|
a *= this->lacunarity;
|
||||||
|
|
||||||
weight = signal * gain;
|
weight = signal * gain;
|
||||||
weight = max (0.0, min (1.0, weight));
|
weight = max (0.0, min (1.0, weight));
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ namespace util {
|
|||||||
m_data (_data)
|
m_data (_data)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
virtual void execute(void)
|
virtual void execute(void)
|
||||||
{ option::execute(); }
|
{ option::execute(); }
|
||||||
virtual void execute(const std::string& data) {
|
virtual void execute(const std::string& data) {
|
||||||
get_arg(data, m_data);
|
get_arg(data, m_data);
|
||||||
@ -253,7 +253,7 @@ namespace util {
|
|||||||
*
|
*
|
||||||
* parse_args will perform minimal interpretation of the arguments to allow
|
* parse_args will perform minimal interpretation of the arguments to allow
|
||||||
* dispatch to registered options. No direct actions upon any input is
|
* dispatch to registered options. No direct actions upon any input is
|
||||||
* performed within this class, merely dispatch and tokenisation.
|
* performed within this class, merely dispatch and tokenisation.
|
||||||
*/
|
*/
|
||||||
class processor {
|
class processor {
|
||||||
protected:
|
protected:
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#error "Unknown platform"
|
#error "Unknown platform"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clang needs to be checked before GCC as it pretends to be GCC
|
// Clang needs to be checked before GCC as it pretends to be GCC
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#define COMPILER_CLANG
|
#define COMPILER_CLANG
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
2
raii.hpp
2
raii.hpp
@ -36,7 +36,7 @@ namespace util {
|
|||||||
T &counter;
|
T &counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Executes a function upon object destruction
|
/// Executes a function upon object destruction
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct scoped_function {
|
struct scoped_function {
|
||||||
|
@ -122,7 +122,7 @@ namespace util {
|
|||||||
{
|
{
|
||||||
double pos = ::rand () / (double)(RAND_MAX);
|
double pos = ::rand () / (double)(RAND_MAX);
|
||||||
return (max - min) * pos + min;
|
return (max - min) * pos + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
float
|
float
|
||||||
@ -174,7 +174,7 @@ util::range<T>::operator ==(const util::range<T> &rhs) const
|
|||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const util::range<T>
|
const util::range<T>
|
||||||
util::range<T>::UNLIMITED (std::numeric_limits<T>::has_infinity ? -std::numeric_limits<T>::infinity () :
|
util::range<T>::UNLIMITED (std::numeric_limits<T>::has_infinity ? -std::numeric_limits<T>::infinity () :
|
||||||
std::numeric_limits<T>::lowest (),
|
std::numeric_limits<T>::lowest (),
|
||||||
|
@ -70,7 +70,7 @@ namespace util {
|
|||||||
range operator- (T) const;
|
range operator- (T) const;
|
||||||
|
|
||||||
/// Return a pseudo-random uniformly distributed value within the range.
|
/// Return a pseudo-random uniformly distributed value within the range.
|
||||||
/// There are no statistical randomness guarantees whatsoever.
|
/// There are no statistical randomness guarantees whatsoever.
|
||||||
T random (void) const;
|
T random (void) const;
|
||||||
|
|
||||||
bool operator ==(const range<T>& rhs) const;
|
bool operator ==(const range<T>& rhs) const;
|
||||||
|
2
si.hpp
2
si.hpp
@ -27,4 +27,4 @@ uintmax_t from_KiB (uintmax_t bytes);
|
|||||||
uintmax_t from_MiB (uintmax_t bytes);
|
uintmax_t from_MiB (uintmax_t bytes);
|
||||||
uintmax_t from_GiB (uintmax_t bytes);
|
uintmax_t from_GiB (uintmax_t bytes);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,7 +131,7 @@ namespace util {
|
|||||||
/// Disconnect all callbacks
|
/// Disconnect all callbacks
|
||||||
template <typename F, template <typename> class C>
|
template <typename F, template <typename> class C>
|
||||||
void
|
void
|
||||||
signal<F,C>::clear (void)
|
signal<F,C>::clear (void)
|
||||||
{
|
{
|
||||||
m_children.clear ();
|
m_children.clear ();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ stringid::add (const std::string key) {
|
|||||||
|
|
||||||
id_t id = m_map.size ();
|
id_t id = m_map.size ();
|
||||||
m_map[key] = id;
|
m_map[key] = id;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ main (int, char**)
|
|||||||
};
|
};
|
||||||
|
|
||||||
box.expand (2.f);
|
box.expand (2.f);
|
||||||
|
|
||||||
tap.expect_eq<util::AABB2f, util::AABB2f> (box, { { 1, 1 }, { 9, 9 }}, "expansion");
|
tap.expect_eq<util::AABB2f, util::AABB2f> (box, { { 1, 1 }, { 9, 9 }}, "expansion");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "colour.hpp"
|
#include "colour.hpp"
|
||||||
|
|
||||||
#include "tap.hpp"
|
#include "tap.hpp"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -40,7 +40,7 @@ test_double (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
test_single (void) {
|
test_single (void) {
|
||||||
struct sized_test {
|
struct sized_test {
|
||||||
ieee_single::uint_t bits;
|
ieee_single::uint_t bits;
|
||||||
@ -57,7 +57,7 @@ test_single (void) {
|
|||||||
|
|
||||||
{ 0x7f800000, numeric_limits<float>::infinity () },
|
{ 0x7f800000, numeric_limits<float>::infinity () },
|
||||||
{ 0xff800000, -numeric_limits<float>::infinity () },
|
{ 0xff800000, -numeric_limits<float>::infinity () },
|
||||||
|
|
||||||
{ 0x3eaaaaab, 1.0f / 3.0f }
|
{ 0x3eaaaaab, 1.0f / 3.0f }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "hash/hotp.hpp"
|
#include "hash/hotp.hpp"
|
||||||
|
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
#include "tap.hpp"
|
#include "tap.hpp"
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
|
|
||||||
uint16_t u16 = 0x1358;
|
uint16_t u16 = 0x1358;
|
||||||
|
@ -186,7 +186,7 @@ test_bytes_opt(void) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *argv[] = {
|
static const char *argv[] = {
|
||||||
"./foo",
|
"./foo",
|
||||||
"-b",
|
"-b",
|
||||||
NULL
|
NULL
|
||||||
@ -197,7 +197,7 @@ test_bytes_opt(void) {
|
|||||||
p->add_option(make_unique<bytesoption> (
|
p->add_option(make_unique<bytesoption> (
|
||||||
'b', "bytes",
|
'b', "bytes",
|
||||||
"testing sizeof bytes", &size, commands[i].type,
|
"testing sizeof bytes", &size, commands[i].type,
|
||||||
commands[i].mod
|
commands[i].mod
|
||||||
));
|
));
|
||||||
|
|
||||||
argv[elems (argv) - 1] = commands[i].param;
|
argv[elems (argv) - 1] = commands[i].param;
|
||||||
|
@ -29,7 +29,7 @@ check_unique_ptr (void) {
|
|||||||
CHECK (success);
|
CHECK (success);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto i = uintset.begin (); i != uintset.end (); ++i)
|
for (auto i = uintset.begin (); i != uintset.end (); ++i)
|
||||||
uintpool.release (*i);
|
uintpool.release (*i);
|
||||||
uintset.clear ();
|
uintset.clear ();
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ check_unique_ptr (void) {
|
|||||||
CHECK (success);
|
CHECK (success);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto i = uintset.begin (); i != uintset.end (); ++i)
|
for (auto i = uintset.begin (); i != uintset.end (); ++i)
|
||||||
uintpool.release (*i);
|
uintpool.release (*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ check_keep_value (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
check_single ();
|
check_single ();
|
||||||
check_unique_ptr ();
|
check_unique_ptr ();
|
||||||
|
@ -15,7 +15,7 @@ void
|
|||||||
test_bool (void) {
|
test_bool (void) {
|
||||||
static const unsigned ITERATIONS = 8192;
|
static const unsigned ITERATIONS = 8192;
|
||||||
static const unsigned THRESHOLD = ITERATIONS / 10;
|
static const unsigned THRESHOLD = ITERATIONS / 10;
|
||||||
|
|
||||||
unsigned counts[2] = { 0, 0 };
|
unsigned counts[2] = { 0, 0 };
|
||||||
for (unsigned i = 0; i < ITERATIONS; ++i)
|
for (unsigned i = 0; i < ITERATIONS; ++i)
|
||||||
++counts[util::random<bool> () ? 0 : 1];
|
++counts[util::random<bool> () ? 0 : 1];
|
||||||
|
@ -37,7 +37,7 @@ test_intersect_aabb (void)
|
|||||||
void
|
void
|
||||||
test_intersect_sphere (void)
|
test_intersect_sphere (void)
|
||||||
{
|
{
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ main (int, char**) {
|
|||||||
|
|
||||||
CHECK (obj.digest () == i.output);
|
CHECK (obj.digest () == i.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
util::TAP::logger tap;
|
util::TAP::logger tap;
|
||||||
tap.skip ("convert to TAP");
|
tap.skip ("convert to TAP");
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ main (void)
|
|||||||
CHECK_EQ (i.query, u.get (util::uri::QUERY));
|
CHECK_EQ (i.query, u.get (util::uri::QUERY));
|
||||||
CHECK_EQ (i.fragment, u.get (util::uri::FRAGMENT));
|
CHECK_EQ (i.fragment, u.get (util::uri::FRAGMENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* BAD[] = {
|
static const char* BAD[] = {
|
||||||
"www.google.com.au",
|
"www.google.com.au",
|
||||||
};
|
};
|
||||||
|
4
time.cpp
4
time.cpp
@ -36,7 +36,7 @@ uint64_t
|
|||||||
util::nanoseconds (void) {
|
util::nanoseconds (void) {
|
||||||
LARGE_INTEGER freq, count;
|
LARGE_INTEGER freq, count;
|
||||||
QueryPerformanceFrequency (&freq);
|
QueryPerformanceFrequency (&freq);
|
||||||
QueryPerformanceCounter (&count);
|
QueryPerformanceCounter (&count);
|
||||||
|
|
||||||
return ((double)count.QuadPart / freq.QuadPart) * SECOND;
|
return ((double)count.QuadPart / freq.QuadPart) * SECOND;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ util::rate_limiter::poll (void) {
|
|||||||
util::polled_duration::polled_duration (std::string name, uint64_t interval):
|
util::polled_duration::polled_duration (std::string name, uint64_t interval):
|
||||||
m_name (name),
|
m_name (name),
|
||||||
m_interval (interval),
|
m_interval (interval),
|
||||||
m_next (nanoseconds () + interval)
|
m_next (nanoseconds () + interval)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// Returns the number of elements of a statically allocated array
|
/// Returns the number of elements of a statically allocated array
|
||||||
template <typename T, size_t N>
|
template <typename T, size_t N>
|
||||||
constexpr size_t elems(const T (&)[N])
|
constexpr size_t elems(const T (&)[N])
|
||||||
{ return N; }
|
{ return N; }
|
||||||
|
|
||||||
|
2
zlib.cpp
2
zlib.cpp
@ -38,7 +38,7 @@ util::zlib::uncompress (uint8_t *dst, size_t dst_len,
|
|||||||
const uint8_t *src, size_t src_len) {
|
const uint8_t *src, size_t src_len) {
|
||||||
size_t actual_len = dst_len;
|
size_t actual_len = dst_len;
|
||||||
uLongf zlib_actual = actual_len;
|
uLongf zlib_actual = actual_len;
|
||||||
|
|
||||||
int err = ::uncompress (dst, &zlib_actual, src, src_len);
|
int err = ::uncompress (dst, &zlib_actual, src, src_len);
|
||||||
error::try_code (err);
|
error::try_code (err);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user