From 0a868641fa3eba59c2e20f553c6027d43e4a73a4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 19 Jul 2018 09:35:13 -0400 Subject: common/swap: Use static_cast where applicable --- src/common/swap.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/common/swap.h b/src/common/swap.h index 23f327201..295c65993 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -185,39 +185,39 @@ public: template swapped_t& operator=(const S& source) { - value = swap((T)source); + value = swap(static_cast(source)); return *this; } operator s8() const { - return (s8)swap(); + return static_cast(swap()); } operator u8() const { - return (u8)swap(); + return static_cast(swap()); } operator s16() const { - return (s16)swap(); + return static_cast(swap()); } operator u16() const { - return (u16)swap(); + return static_cast(swap()); } operator s32() const { - return (s32)swap(); + return static_cast(swap()); } operator u32() const { - return (u32)swap(); + return static_cast(swap()); } operator s64() const { - return (s64)swap(); + return static_cast(swap()); } operator u64() const { - return (u64)swap(); + return static_cast(swap()); } operator float() const { - return (float)swap(); + return static_cast(swap()); } operator double() const { - return (double)swap(); + return static_cast(swap()); } // +v @@ -253,7 +253,7 @@ public: } template swapped_t operator+(const S& i) const { - return swap() + (T)i; + return swap() + static_cast(i); } // v - 5 swapped_t operator-(const swapped_t& i) const { @@ -261,7 +261,7 @@ public: } template swapped_t operator-(const S& i) const { - return swap() - (T)i; + return swap() - static_cast(i); } // v += 5 @@ -271,7 +271,7 @@ public: } template swapped_t& operator+=(const S& i) { - value = swap(swap() + (T)i); + value = swap(swap() + static_cast(i)); return *this; } // v -= 5 @@ -281,7 +281,7 @@ public: } template swapped_t& operator-=(const S& i) { - value = swap(swap() - (T)i); + value = swap(swap() - static_cast(i)); return *this; } @@ -541,7 +541,7 @@ S operator&(const S& i, const swap_struct_t v) { template S operator&(const swap_struct_t v, const S& i) { - return (S)(v.swap() & i); + return static_cast(v.swap() & i); } // Comparaison -- cgit v1.2.3