diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2019-09-11 05:53:10 -0700 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2019-09-11 05:53:10 -0700 |
commit | 388928f3aa1ecf1a4f930c27687e7d0d4a9fd824 (patch) | |
tree | 082cbddc17fd07325935bf57d087c31d9ea24405 /common | |
parent | e4b15aeefcc220a46542c4bb2a2cea033e7954f0 (diff) |
Fix some more implicit casts
Diffstat (limited to 'common')
-rw-r--r-- | common/albyte.h | 2 | ||||
-rw-r--r-- | common/alspan.h | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/common/albyte.h b/common/albyte.h index c7f4d219..798d136d 100644 --- a/common/albyte.h +++ b/common/albyte.h @@ -38,7 +38,7 @@ inline al::byte& operator>>=(al::byte &lhs, T rhs) noexcept #define AL_DECL_OP(op) \ template<typename T, REQUIRES(std::is_integral<T>::value)> \ inline constexpr al::byte operator op (al::byte lhs, T rhs) noexcept \ -{ return al::byte(to_integer<unsigned int>(lhs) op rhs); } \ +{ return al::byte(to_integer<unsigned int>(lhs) op static_cast<unsigned int>(rhs)); } \ template<typename T, REQUIRES(std::is_integral<T>::value)> \ inline al::byte& operator op##= (al::byte &lhs, T rhs) noexcept \ { lhs = lhs op rhs; return lhs; } \ diff --git a/common/alspan.h b/common/alspan.h index 63b36eaa..4fe0f111 100644 --- a/common/alspan.h +++ b/common/alspan.h @@ -221,8 +221,9 @@ public: constexpr reference operator[](index_type idx) const { return mData[idx]; } constexpr pointer data() const noexcept { return mData; } - constexpr index_type size() const noexcept { return mDataEnd-mData; } - constexpr index_type size_bytes() const noexcept { return (mDataEnd-mData) * sizeof(value_type); } + constexpr index_type size() const noexcept { return static_cast<index_type>(mDataEnd-mData); } + constexpr index_type size_bytes() const noexcept + { return static_cast<index_type>(mDataEnd-mData) * sizeof(value_type); } constexpr bool empty() const noexcept { return mData == mDataEnd; } constexpr iterator begin() const noexcept { return mData; } |