Skip to content

Commit 729919f

Browse files
committed
minor cosmetic updates here and there
1 parent 65c665e commit 729919f

File tree

10 files changed

+57
-35
lines changed

10 files changed

+57
-35
lines changed

arena/include/cpp-utilities/arena.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class malloc_storage {
5454
free(p_);
5555
}
5656

57-
malloc_storage(const malloc_storage &) = delete;
57+
malloc_storage(const malloc_storage &) = delete;
5858
malloc_storage &operator=(const malloc_storage &) = delete;
5959

6060
malloc_storage(malloc_storage &&other) noexcept
@@ -86,11 +86,11 @@ class arena_allocator<T, Count, bitset_strategy_tag> {
8686
freelist_.set();
8787
}
8888

89-
arena_allocator(arena_allocator &&) noexcept = default;
89+
arena_allocator(arena_allocator &&) noexcept = default;
9090
arena_allocator &operator=(arena_allocator &&) noexcept = default;
9191
arena_allocator(const arena_allocator &) = delete;
92-
arena_allocator &operator=(const arena_allocator &) = delete;
93-
~arena_allocator() = default;
92+
arena_allocator &operator=(const arena_allocator &) = delete;
93+
~arena_allocator() = default;
9494

9595
public:
9696
void release(void *ptr) noexcept {
@@ -161,7 +161,7 @@ class arena_allocator<T, Count, linked_strategy_tag> {
161161
}
162162

163163
private:
164-
arena_allocator(const arena_allocator &) = delete;
164+
arena_allocator(const arena_allocator &) = delete;
165165
arena_allocator &operator=(const arena_allocator &) = delete;
166166

167167
public:

container/include/cpp-utilities/flat_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class flat_map {
4747
}
4848

4949
public:
50-
// for convinience
50+
// for convenience
5151
bool operator()(const key_type &lhs, const value_type &rhs) const {
5252
return comp(lhs, rhs.first);
5353
}

fixed/include/cpp-utilities/fixed.h

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class fixed;
4747
namespace detail {
4848

4949
// helper templates to make magic with types :)
50-
// these allow us to determine resonable types from
50+
// these allow us to determine reasonable types from
5151
// a desired size, they also let us infer the next largest type
5252
// from a type which is nice for the division op
5353
template <size_t T>
@@ -284,8 +284,8 @@ class fixed {
284284
static constexpr base_type one = base_type(1) << fractional_bits;
285285

286286
public: // constructors
287-
fixed() = default;
288-
fixed(const fixed &) = default;
287+
fixed() = default;
288+
fixed(const fixed &) = default;
289289
fixed &operator=(const fixed &) = default;
290290

291291
template <class Number>
@@ -538,16 +538,19 @@ CONSTEXPR14 fixed<I, F> operator+(fixed<I, F> lhs, fixed<I, F> rhs) {
538538
lhs += rhs;
539539
return lhs;
540540
}
541+
541542
template <size_t I, size_t F>
542543
CONSTEXPR14 fixed<I, F> operator-(fixed<I, F> lhs, fixed<I, F> rhs) {
543544
lhs -= rhs;
544545
return lhs;
545546
}
547+
546548
template <size_t I, size_t F>
547549
CONSTEXPR14 fixed<I, F> operator*(fixed<I, F> lhs, fixed<I, F> rhs) {
548550
lhs *= rhs;
549551
return lhs;
550552
}
553+
551554
template <size_t I, size_t F>
552555
CONSTEXPR14 fixed<I, F> operator/(fixed<I, F> lhs, fixed<I, F> rhs) {
553556
lhs /= rhs;
@@ -559,16 +562,19 @@ CONSTEXPR14 fixed<I, F> operator+(fixed<I, F> lhs, Number rhs) {
559562
lhs += fixed<I, F>(rhs);
560563
return lhs;
561564
}
565+
562566
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
563567
CONSTEXPR14 fixed<I, F> operator-(fixed<I, F> lhs, Number rhs) {
564568
lhs -= fixed<I, F>(rhs);
565569
return lhs;
566570
}
571+
567572
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
568573
CONSTEXPR14 fixed<I, F> operator*(fixed<I, F> lhs, Number rhs) {
569574
lhs *= fixed<I, F>(rhs);
570575
return lhs;
571576
}
577+
572578
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
573579
CONSTEXPR14 fixed<I, F> operator/(fixed<I, F> lhs, Number rhs) {
574580
lhs /= fixed<I, F>(rhs);
@@ -581,18 +587,21 @@ CONSTEXPR14 fixed<I, F> operator+(Number lhs, fixed<I, F> rhs) {
581587
tmp += rhs;
582588
return tmp;
583589
}
590+
584591
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
585592
CONSTEXPR14 fixed<I, F> operator-(Number lhs, fixed<I, F> rhs) {
586593
fixed<I, F> tmp(lhs);
587594
tmp -= rhs;
588595
return tmp;
589596
}
597+
590598
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
591599
CONSTEXPR14 fixed<I, F> operator*(Number lhs, fixed<I, F> rhs) {
592600
fixed<I, F> tmp(lhs);
593601
tmp *= rhs;
594602
return tmp;
595603
}
604+
596605
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
597606
CONSTEXPR14 fixed<I, F> operator/(Number lhs, fixed<I, F> rhs) {
598607
fixed<I, F> tmp(lhs);
@@ -606,6 +615,7 @@ CONSTEXPR14 fixed<I, F> operator<<(fixed<I, F> lhs, Integer rhs) {
606615
lhs <<= rhs;
607616
return lhs;
608617
}
618+
609619
template <size_t I, size_t F, class Integer, class = typename std::enable_if<std::is_integral<Integer>::value>::type>
610620
CONSTEXPR14 fixed<I, F> operator>>(fixed<I, F> lhs, Integer rhs) {
611621
lhs >>= rhs;
@@ -617,22 +627,27 @@ template <size_t I, size_t F, class Number, class = typename std::enable_if<std:
617627
constexpr bool operator>(fixed<I, F> lhs, Number rhs) {
618628
return lhs > fixed<I, F>(rhs);
619629
}
630+
620631
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
621632
constexpr bool operator<(fixed<I, F> lhs, Number rhs) {
622633
return lhs < fixed<I, F>(rhs);
623634
}
635+
624636
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
625637
constexpr bool operator>=(fixed<I, F> lhs, Number rhs) {
626638
return lhs >= fixed<I, F>(rhs);
627639
}
640+
628641
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
629642
constexpr bool operator<=(fixed<I, F> lhs, Number rhs) {
630643
return lhs <= fixed<I, F>(rhs);
631644
}
645+
632646
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
633647
constexpr bool operator==(fixed<I, F> lhs, Number rhs) {
634648
return lhs == fixed<I, F>(rhs);
635649
}
650+
636651
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
637652
constexpr bool operator!=(fixed<I, F> lhs, Number rhs) {
638653
return lhs != fixed<I, F>(rhs);
@@ -642,26 +657,32 @@ template <size_t I, size_t F, class Number, class = typename std::enable_if<std:
642657
constexpr bool operator>(Number lhs, fixed<I, F> rhs) {
643658
return fixed<I, F>(lhs) > rhs;
644659
}
660+
645661
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
646662
constexpr bool operator<(Number lhs, fixed<I, F> rhs) {
647663
return fixed<I, F>(lhs) < rhs;
648664
}
665+
649666
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
650667
constexpr bool operator>=(Number lhs, fixed<I, F> rhs) {
651668
return fixed<I, F>(lhs) >= rhs;
652669
}
670+
653671
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
654672
constexpr bool operator<=(Number lhs, fixed<I, F> rhs) {
655673
return fixed<I, F>(lhs) <= rhs;
656674
}
675+
657676
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
658677
constexpr bool operator==(Number lhs, fixed<I, F> rhs) {
659678
return fixed<I, F>(lhs) == rhs;
660679
}
680+
661681
template <size_t I, size_t F, class Number, class = typename std::enable_if<std::is_arithmetic<Number>::value>::type>
662682
constexpr bool operator!=(Number lhs, fixed<I, F> rhs) {
663683
return fixed<I, F>(lhs) != rhs;
664684
}
685+
665686
}
666687

667688
#undef CONSTEXPR14

hash/include/cpp-utilities/md5.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class md5 {
125125
0x67452301,
126126
0xefcdab89,
127127
0x98badcfe,
128-
0x10325476};
128+
0x10325476,
129+
};
129130
};
130131

131132
public:

hash/include/cpp-utilities/sha1.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class sha1 {
9797
0xefcdab89,
9898
0x98badcfe,
9999
0x10325476,
100-
0xc3d2e1f0};
100+
0xc3d2e1f0,
101+
};
101102
};
102103

103104
public:

logger/include/cpp-utilities/logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ inline bool timedate() {
153153
}
154154

155155
//------------------------------------------------------------------------------
156-
// Name: timedate
156+
// Name: fullpath
157157
//------------------------------------------------------------------------------
158158
inline bool fullpath() {
159159
static const bool t = [] {

programs/byte_writer.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2-
#include <iostream>
3-
#include <fstream>
42
#include <cstdio>
3+
#include <fstream>
4+
#include <iostream>
55

66
namespace {
7-
const int col = 16;
7+
constexpr int Columns = 16;
88
}
99

1010
int main(int argc, char *argv[]) {
1111

12-
if(argc != 2) {
12+
if (argc != 2) {
1313
std::cerr << "usage: " << argv[0] << " <filename>\n";
1414
return -1;
1515
}
@@ -19,24 +19,23 @@ int main(int argc, char *argv[]) {
1919
char ch;
2020
size_t index = 0;
2121

22-
while(file.get(ch)) {
23-
if(index == 0) {
22+
while (file.get(ch)) {
23+
if (index == 0) {
2424
putchar('"');
2525
}
2626

2727
printf("\\x%02x", static_cast<unsigned>(ch) & 0xff);
2828

29-
index = (index + 1) % col;
29+
index = (index + 1) % Columns;
3030

31-
if(index == 0) {
31+
if (index == 0) {
3232
putchar('"');
3333
putchar('\n');
3434
}
3535
}
3636

37-
if(index != 0) {
37+
if (index != 0) {
3838
putchar('"');
39-
putchar('\n');
39+
putchar('\n');
4040
}
41-
4241
}

range/include/cpp-utilities/range.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class const_iterator {
4848
: value_(value) {
4949
}
5050

51-
const_iterator(const const_iterator &) = default;
51+
const_iterator(const const_iterator &) = default;
5252
const_iterator &operator=(const const_iterator &) = default;
5353

5454
public:

uint128/include/cpp-utilities/uint128.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void divide(const T &numerator, const T &denominator, T &quotient, T &rem
7171
}
7272
}
7373

74-
// convinience macro
74+
// convenience macro
7575
#define U128_C(s) uint128(#s)
7676

7777
class uint128 : public boost::shiftable<uint128, boost::totally_ordered<uint128, boost::integer_arithmetic<uint128, boost::bitwise<uint128, boost::unit_steppable<uint128>>>>> {
@@ -324,10 +324,10 @@ class uint128 : public boost::shiftable<uint128, boost::totally_ordered<uint128,
324324
hi = 0;
325325
lo = 0;
326326
} else {
327-
const unsigned int halfsize = size / 2;
327+
const unsigned int half_size = size / 2;
328328

329-
if (n >= halfsize) {
330-
n -= halfsize;
329+
if (n >= half_size) {
330+
n -= half_size;
331331
hi = lo;
332332
lo = 0;
333333
}
@@ -339,7 +339,7 @@ class uint128 : public boost::shiftable<uint128, boost::totally_ordered<uint128,
339339
const base_type mask(~(base_type(-1) >> n));
340340

341341
// and add them to high half
342-
hi |= (lo & mask) >> (halfsize - n);
342+
hi |= (lo & mask) >> (half_size - n);
343343

344344
// and finally shift also low half
345345
lo <<= n;
@@ -357,10 +357,10 @@ class uint128 : public boost::shiftable<uint128, boost::totally_ordered<uint128,
357357
hi = 0;
358358
lo = 0;
359359
} else {
360-
const unsigned int halfsize = size / 2;
360+
const unsigned int half_size = size / 2;
361361

362-
if (n >= halfsize) {
363-
n -= halfsize;
362+
if (n >= half_size) {
363+
n -= half_size;
364364
lo = hi;
365365
hi = 0;
366366
}
@@ -373,7 +373,7 @@ class uint128 : public boost::shiftable<uint128, boost::totally_ordered<uint128,
373373
const base_type mask(~(base_type(-1) << n));
374374

375375
// and add them to low qword
376-
lo |= (hi & mask) << (halfsize - n);
376+
lo |= (hi & mask) << (half_size - n);
377377

378378
// and finally shift also high half
379379
hi >>= n;

uuid/include/cpp-utilities/uuid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
class uuid {
3636
public:
37-
uuid() = default;
38-
uuid(const uuid &) = default;
37+
uuid() = default;
38+
uuid(const uuid &) = default;
3939
uuid &operator=(const uuid &) = default;
4040

4141
public:

0 commit comments

Comments
 (0)