Detab beast

This commit is contained in:
Howard Hinnant
2014-10-14 17:27:16 -04:00
committed by Tom Ritchford
parent f034b02b92
commit 75c8d7aa57
9 changed files with 200 additions and 200 deletions

View File

@@ -266,7 +266,7 @@ namespace detail {
static double monotonicCurrentTimeInSeconds()
{
return GetTickCount64() / 1000.0;
return GetTickCount64() / 1000.0;
}
}
@@ -282,36 +282,36 @@ namespace detail {
static double monotonicCurrentTimeInSeconds()
{
struct StaticInitializer
{
StaticInitializer ()
{
double numerator;
double denominator;
struct StaticInitializer
{
StaticInitializer ()
{
double numerator;
double denominator;
mach_timebase_info_data_t timebase;
(void) mach_timebase_info (&timebase);
mach_timebase_info_data_t timebase;
(void) mach_timebase_info (&timebase);
if (timebase.numer % 1000000 == 0)
{
numerator = timebase.numer / 1000000.0;
denominator = timebase.denom * 1000.0;
}
else
{
numerator = timebase.numer;
if (timebase.numer % 1000000 == 0)
{
numerator = timebase.numer / 1000000.0;
denominator = timebase.denom * 1000.0;
}
else
{
numerator = timebase.numer;
// VFALCO NOTE I don't understand this code
//denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0;
//denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0;
denominator = timebase.denom * 1000000000.0;
}
}
ratio = numerator / denominator;
}
ratio = numerator / denominator;
}
double ratio;
};
double ratio;
};
static StaticInitializer const data;
static StaticInitializer const data;
return mach_absolute_time() * data.ratio;
}
@@ -327,9 +327,9 @@ namespace detail {
static double monotonicCurrentTimeInSeconds()
{
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return t.tv_sec + t.tv_nsec / 1000000000.0;
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return t.tv_sec + t.tv_nsec / 1000000000.0;
}
}
@@ -343,26 +343,26 @@ namespace detail {
// Records and returns the time from process startup
static double getStartupTime()
{
struct StaticInitializer
{
StaticInitializer ()
{
struct StaticInitializer
{
StaticInitializer ()
{
when = detail::monotonicCurrentTimeInSeconds();
}
double when;
};
};
static StaticInitializer const data;
static StaticInitializer const data;
return data.when;
return data.when;
}
// Used to call getStartupTime as early as possible
struct StartupTimeStaticInitializer
{
StartupTimeStaticInitializer ()
{
StartupTimeStaticInitializer ()
{
getStartupTime();
}
};
@@ -373,7 +373,7 @@ static StartupTimeStaticInitializer startupTimeStaticInitializer;
RelativeTime RelativeTime::fromStartup ()
{
return RelativeTime (
return RelativeTime (
detail::monotonicCurrentTimeInSeconds() - detail::getStartupTime());
}

View File

@@ -141,154 +141,154 @@ Here is a short example demonstrating its use.
\snippet cyclic_iterator.cpp cyclic_iterator
*/
template<
typename ContainerIterator
typename ContainerIterator
>
class cyclic_iterator
:
public detail::cyclic_iterator_base<
ContainerIterator
>::type
public detail::cyclic_iterator_base<
ContainerIterator
>::type
{
public:
/**
\brief The base type which is a <code>boost::iterator_facade</code>
*/
typedef typename detail::cyclic_iterator_base<
ContainerIterator
>::type base_type;
/**
\brief The base type which is a <code>boost::iterator_facade</code>
*/
typedef typename detail::cyclic_iterator_base<
ContainerIterator
>::type base_type;
/**
\brief The underlying iterator type
*/
typedef ContainerIterator container_iterator_type;
/**
\brief The underlying iterator type
*/
typedef ContainerIterator container_iterator_type;
/**
\brief The value type adapted from \a ContainerIterator
*/
typedef typename base_type::value_type value_type;
/**
\brief The value type adapted from \a ContainerIterator
*/
typedef typename base_type::value_type value_type;
/**
\brief The reference type adapted from \a ContainerIterator
*/
typedef typename base_type::reference reference;
/**
\brief The reference type adapted from \a ContainerIterator
*/
typedef typename base_type::reference reference;
/**
\brief The pointer type adapted from \a ContainerIterator
*/
typedef typename base_type::pointer pointer;
/**
\brief The pointer type adapted from \a ContainerIterator
*/
typedef typename base_type::pointer pointer;
/**
\brief The difference type adapted from \a ContainerIterator
*/
typedef typename base_type::difference_type difference_type;
/**
\brief The difference type adapted from \a ContainerIterator
*/
typedef typename base_type::difference_type difference_type;
/**
\brief The iterator category, either Forward or Bidirectional
*/
typedef typename base_type::iterator_category iterator_category;
/**
\brief The iterator category, either Forward or Bidirectional
*/
typedef typename base_type::iterator_category iterator_category;
/**
\brief Creates a singular iterator
*/
cyclic_iterator();
/**
\brief Creates a singular iterator
*/
cyclic_iterator();
/**
\brief Copy constructs from another cyclic iterator
/**
\brief Copy constructs from another cyclic iterator
Copy constructs from another cyclic iterator \a other. This only works
if the underlying iterators are convertible.
Copy constructs from another cyclic iterator \a other. This only works
if the underlying iterators are convertible.
\param other The iterator to copy construct from
*/
template<
typename OtherIterator
>
explicit
cyclic_iterator(
cyclic_iterator<OtherIterator> const &other
);
\param other The iterator to copy construct from
*/
template<
typename OtherIterator
>
explicit
cyclic_iterator(
cyclic_iterator<OtherIterator> const &other
);
/**
\brief Constructs a new cyclic iterator
/**
\brief Constructs a new cyclic iterator
Constructs a new cyclic iterator, starting at \a it, inside
a range from \a begin to \a end.
Constructs a new cyclic iterator, starting at \a it, inside
a range from \a begin to \a end.
\param pos The start of the iterator
\param begin The beginning of the range
\param end The end of the range
\param pos The start of the iterator
\param begin The beginning of the range
\param end The end of the range
\warning The behaviour is undefined if \a pos isn't between \a begin
and \a end. Also, the behaviour is undefined, if \a begin and \a end
don't form a valid range.
*/
cyclic_iterator(
container_iterator_type const &pos,
container_iterator_type const &begin,
container_iterator_type const &end
);
\warning The behaviour is undefined if \a pos isn't between \a begin
and \a end. Also, the behaviour is undefined, if \a begin and \a end
don't form a valid range.
*/
cyclic_iterator(
container_iterator_type const &pos,
container_iterator_type const &begin,
container_iterator_type const &end
);
/**
\brief Assigns from another cyclic iterator
/**
\brief Assigns from another cyclic iterator
Assigns from another cyclic iterator \a other. This only works if the
underlying iterators are convertible.
Assigns from another cyclic iterator \a other. This only works if the
underlying iterators are convertible.
\param other The iterator to assign from
\param other The iterator to assign from
\return <code>*this</code>
*/
template<
typename OtherIterator
>
cyclic_iterator<ContainerIterator> &
operator=(
cyclic_iterator<OtherIterator> const &other
);
\return <code>*this</code>
*/
template<
typename OtherIterator
>
cyclic_iterator<ContainerIterator> &
operator=(
cyclic_iterator<OtherIterator> const &other
);
/**
\brief Returns the beginning of the range
*/
container_iterator_type
begin() const;
/**
\brief Returns the beginning of the range
*/
container_iterator_type
begin() const;
/**
\brief Returns the end of the range
*/
container_iterator_type
end() const;
/**
\brief Returns the end of the range
*/
container_iterator_type
end() const;
/**
\brief Returns the underlying iterator
*/
container_iterator_type
get() const;
/**
\brief Returns the underlying iterator
*/
container_iterator_type
get() const;
private:
friend class boost::iterator_core_access;
friend class boost::iterator_core_access;
void
increment();
void
increment();
void
decrement();
void
decrement();
bool
equal(
cyclic_iterator const &
) const;
bool
equal(
cyclic_iterator const &
) const;
reference
dereference() const;
reference
dereference() const;
difference_type
distance_to(
cyclic_iterator const &
) const;
difference_type
distance_to(
cyclic_iterator const &
) const;
private:
container_iterator_type
it_,
begin_,
end_;
container_iterator_type
it_,
begin_,
end_;
};
//

View File

@@ -166,7 +166,7 @@ void SpookyHash::Hash128(
while (u.p64 < end)
{
Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
u.p64 += sc_numVars;
u.p64 += sc_numVars;
}
}
else
@@ -175,7 +175,7 @@ void SpookyHash::Hash128(
{
memcpy(buf, u.p64, sc_blockSize);
Mix(buf, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
u.p64 += sc_numVars;
u.p64 += sc_numVars;
}
}
@@ -275,7 +275,7 @@ void SpookyHash::Update(const void *message, size_t length)
while (u.p64 < end)
{
Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
u.p64 += sc_numVars;
u.p64 += sc_numVars;
}
}
else
@@ -284,7 +284,7 @@ void SpookyHash::Update(const void *message, size_t length)
{
memcpy(m_data, u.p8, sc_blockSize);
Mix(m_data, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
u.p64 += sc_numVars;
u.p64 += sc_numVars;
}
}

View File

@@ -42,9 +42,9 @@ typedef std::array <std::uint8_t, digestLength> digest_type;
namespace detail {
struct Context
{
std::uint32_t state[8];
std::uint64_t bitcount;
std::uint8_t buffer[Sha256::blockLength];
std::uint32_t state[8];
std::uint64_t bitcount;
std::uint8_t buffer[Sha256::blockLength];
};
}

View File

@@ -154,14 +154,14 @@ void subtract_integer(integer left, integer right, integer result) {
double_component_t lhs = left.c[i];
double_component_t rhs = (i < right.num_components) ? right.c[i] : 0;
if (borrow) {
if (lhs <= rhs) {
/* leave borrow set to 1 */
lhs += (MAX_COMPONENT + 1) - 1;
} else {
borrow = 0;
lhs--;
}
}
if (lhs <= rhs) {
/* leave borrow set to 1 */
lhs += (MAX_COMPONENT + 1) - 1;
} else {
borrow = 0;
lhs--;
}
}
if (lhs < rhs) {
borrow = 1;
lhs += MAX_COMPONENT + 1;

View File

@@ -55,7 +55,7 @@ is_white (CharT c)
case '\r': case '\t': case '\v':
return true;
};
return false;
return false;
}
/** Returns `true` if `c` is a control character. */
@@ -85,24 +85,24 @@ template <class FwdIter>
FwdIter
trim_left (FwdIter first, FwdIter last)
{
return std::find_if_not (first, last,
&is_white <typename FwdIter::value_type>);
return std::find_if_not (first, last,
&is_white <typename FwdIter::value_type>);
}
template <class FwdIter>
FwdIter
trim_right (FwdIter first, FwdIter last)
{
if (first == last)
return last;
do
{
--last;
if (! is_white (*last))
return ++last;
}
while (last != first);
return first;
if (first == last)
return last;
do
{
--last;
if (! is_white (*last))
return ++last;
}
while (last != first);
return first;
}
template <class CharT, class Traits, class Allocator>
@@ -118,9 +118,9 @@ template <class FwdIter>
std::pair <FwdIter, FwdIter>
trim (FwdIter first, FwdIter last)
{
first = trim_left (first, last);
last = trim_right (first, last);
return std::make_pair (first, last);
first = trim_left (first, last);
last = trim_right (first, last);
return std::make_pair (first, last);
}
template <class String>
@@ -131,7 +131,7 @@ trim (String const& s)
using std::end;
auto first (begin(s));
auto last (end(s));
std::tie (first, last) = trim (first, last);
std::tie (first, last) = trim (first, last);
return { first, last };
}
@@ -143,7 +143,7 @@ trim_right (String const& s)
using std::end;
auto first (begin(s));
auto last (end(s));
last = trim_right (first, last);
last = trim_right (first, last);
return { first, last };
}

View File

@@ -28,7 +28,7 @@ namespace http {
std::vector <char const*> const&
urls_large_data()
{
static std::vector <char const*> const urls ({
static std::vector <char const*> const urls ({
"google.com",
"facebook.com",
"youtube.com",
@@ -10030,7 +10030,7 @@ urls_large_data()
"18schoolgirlz.com"
});
return urls;
return urls;
}
}

View File

@@ -247,8 +247,8 @@ private:
static HiResCounterHandler& hiResCounterHandler()
{
static HiResCounterHandler hiResCounterHandler;
return hiResCounterHandler;
static HiResCounterHandler hiResCounterHandler;
return hiResCounterHandler;
}
std::uint32_t beast_millisecondsSinceStartup() noexcept { return hiResCounterHandler().millisecondsSinceStartup(); }

View File

@@ -352,7 +352,7 @@ protected:
void wait();
virtual void enqueue (Item* item);
bool empty();
bool empty();
virtual std::size_t dequeue() = 0;
virtual Waiter* new_waiter() = 0;