summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/fiber.h4
-rw-r--r--src/common/file_util.h3
-rw-r--r--src/common/math_util.h4
-rw-r--r--src/common/multi_level_queue.h2
-rw-r--r--src/common/spin_lock.h8
-rw-r--r--src/common/swap.h10
-rw-r--r--src/common/thread_queue_list.h4
7 files changed, 13 insertions, 22 deletions
diff --git a/src/common/fiber.h b/src/common/fiber.h
index bc1db1582..89dde5e36 100644
--- a/src/common/fiber.h
+++ b/src/common/fiber.h
@@ -41,8 +41,8 @@ public:
41 Fiber(const Fiber&) = delete; 41 Fiber(const Fiber&) = delete;
42 Fiber& operator=(const Fiber&) = delete; 42 Fiber& operator=(const Fiber&) = delete;
43 43
44 Fiber(Fiber&&) = delete; 44 Fiber(Fiber&&) = default;
45 Fiber& operator=(Fiber&&) = delete; 45 Fiber& operator=(Fiber&&) = default;
46 46
47 /// Yields control from Fiber 'from' to Fiber 'to' 47 /// Yields control from Fiber 'from' to Fiber 'to'
48 /// Fiber 'from' must be the currently running fiber. 48 /// Fiber 'from' must be the currently running fiber.
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 508b7a10a..8b587320f 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -189,8 +189,7 @@ template <typename T>
189 return {}; 189 return {};
190 } 190 }
191 last = std::min<std::size_t>(last, vector.size()); 191 last = std::min<std::size_t>(last, vector.size());
192 return std::vector<T>(vector.begin() + static_cast<std::ptrdiff_t>(first), 192 return std::vector<T>(vector.begin() + first, vector.begin() + first + last);
193 vector.begin() + static_cast<std::ptrdiff_t>(first + last));
194} 193}
195 194
196enum class DirectorySeparator { 195enum class DirectorySeparator {
diff --git a/src/common/math_util.h b/src/common/math_util.h
index 4c38d8040..7cec80d57 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -27,7 +27,7 @@ struct Rectangle {
27 if constexpr (std::is_floating_point_v<T>) { 27 if constexpr (std::is_floating_point_v<T>) {
28 return std::abs(right - left); 28 return std::abs(right - left);
29 } else { 29 } else {
30 return static_cast<T>(std::abs(static_cast<std::make_signed_t<T>>(right - left))); 30 return std::abs(static_cast<std::make_signed_t<T>>(right - left));
31 } 31 }
32 } 32 }
33 33
@@ -35,7 +35,7 @@ struct Rectangle {
35 if constexpr (std::is_floating_point_v<T>) { 35 if constexpr (std::is_floating_point_v<T>) {
36 return std::abs(bottom - top); 36 return std::abs(bottom - top);
37 } else { 37 } else {
38 return static_cast<T>(std::abs(static_cast<std::make_signed_t<T>>(bottom - top))); 38 return std::abs(static_cast<std::make_signed_t<T>>(bottom - top));
39 } 39 }
40 } 40 }
41 41
diff --git a/src/common/multi_level_queue.h b/src/common/multi_level_queue.h
index 71613f18b..4b305bf40 100644
--- a/src/common/multi_level_queue.h
+++ b/src/common/multi_level_queue.h
@@ -320,7 +320,7 @@ private:
320 } 320 }
321 321
322 const auto begin_range = list.begin(); 322 const auto begin_range = list.begin();
323 const auto end_range = std::next(begin_range, static_cast<std::ptrdiff_t>(shift)); 323 const auto end_range = std::next(begin_range, shift);
324 list.splice(list.end(), list, begin_range, end_range); 324 list.splice(list.end(), list, begin_range, end_range);
325 } 325 }
326 326
diff --git a/src/common/spin_lock.h b/src/common/spin_lock.h
index 06ac2f5bb..4f946a258 100644
--- a/src/common/spin_lock.h
+++ b/src/common/spin_lock.h
@@ -15,14 +15,6 @@ namespace Common {
15 */ 15 */
16class SpinLock { 16class SpinLock {
17public: 17public:
18 SpinLock() = default;
19
20 SpinLock(const SpinLock&) = delete;
21 SpinLock& operator=(const SpinLock&) = delete;
22
23 SpinLock(SpinLock&&) = delete;
24 SpinLock& operator=(SpinLock&&) = delete;
25
26 void lock(); 18 void lock();
27 void unlock(); 19 void unlock();
28 [[nodiscard]] bool try_lock(); 20 [[nodiscard]] bool try_lock();
diff --git a/src/common/swap.h b/src/common/swap.h
index 8c68c1f26..7665942a2 100644
--- a/src/common/swap.h
+++ b/src/common/swap.h
@@ -504,35 +504,35 @@ bool operator==(const S& p, const swap_struct_t<T, F> v) {
504template <typename T> 504template <typename T>
505struct swap_64_t { 505struct swap_64_t {
506 static T swap(T x) { 506 static T swap(T x) {
507 return static_cast<T>(Common::swap64(static_cast<u64>(x))); 507 return static_cast<T>(Common::swap64(x));
508 } 508 }
509}; 509};
510 510
511template <typename T> 511template <typename T>
512struct swap_32_t { 512struct swap_32_t {
513 static T swap(T x) { 513 static T swap(T x) {
514 return static_cast<T>(Common::swap32(static_cast<u32>(x))); 514 return static_cast<T>(Common::swap32(x));
515 } 515 }
516}; 516};
517 517
518template <typename T> 518template <typename T>
519struct swap_16_t { 519struct swap_16_t {
520 static T swap(T x) { 520 static T swap(T x) {
521 return static_cast<T>(Common::swap16(static_cast<u16>(x))); 521 return static_cast<T>(Common::swap16(x));
522 } 522 }
523}; 523};
524 524
525template <typename T> 525template <typename T>
526struct swap_float_t { 526struct swap_float_t {
527 static T swap(T x) { 527 static T swap(T x) {
528 return static_cast<T>(Common::swapf(static_cast<float>(x))); 528 return static_cast<T>(Common::swapf(x));
529 } 529 }
530}; 530};
531 531
532template <typename T> 532template <typename T>
533struct swap_double_t { 533struct swap_double_t {
534 static T swap(T x) { 534 static T swap(T x) {
535 return static_cast<T>(Common::swapd(static_cast<double>(x))); 535 return static_cast<T>(Common::swapd(x));
536 } 536 }
537}; 537};
538 538
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h
index 69c9193da..def9e5d8d 100644
--- a/src/common/thread_queue_list.h
+++ b/src/common/thread_queue_list.h
@@ -33,7 +33,7 @@ struct ThreadQueueList {
33 } 33 }
34 } 34 }
35 35
36 return static_cast<Priority>(-1); 36 return -1;
37 } 37 }
38 38
39 [[nodiscard]] T get_first() const { 39 [[nodiscard]] T get_first() const {
@@ -156,7 +156,7 @@ private:
156 void link(Priority priority) { 156 void link(Priority priority) {
157 Queue* cur = &queues[priority]; 157 Queue* cur = &queues[priority];
158 158
159 for (auto i = static_cast<int>(priority - 1); i >= 0; --i) { 159 for (int i = priority - 1; i >= 0; --i) {
160 if (queues[i].next_nonempty != UnlinkedTag()) { 160 if (queues[i].next_nonempty != UnlinkedTag()) {
161 cur->next_nonempty = queues[i].next_nonempty; 161 cur->next_nonempty = queues[i].next_nonempty;
162 queues[i].next_nonempty = cur; 162 queues[i].next_nonempty = cur;