Mercurial > code
changeset 295:345aaeb5e0ba
Pack: fix constexpr can't be used on void return types
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 13 Nov 2014 21:07:48 +0100 |
parents | 434a6a289206 |
children | 5806c767aec7 |
files | C++/Pack.h C++/Tests/Pack/main.cpp |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/C++/Pack.h Thu Nov 13 21:04:28 2014 +0100 +++ b/C++/Pack.h Thu Nov 13 21:07:48 2014 +0100 @@ -366,7 +366,7 @@ template <> struct Pack::TypeInfo<uint8_t> : public Pack::Convertible { - static constexpr void convert(uint8_t &) noexcept + static inline void convert(uint8_t &) noexcept { // uint8_t are endian independent } @@ -374,7 +374,7 @@ template <> struct Pack::TypeInfo<uint16_t> : public Pack::Convertible { - static constexpr void convert(uint16_t &v) + static inline void convert(uint16_t &v) { v = (((v >> 8) & 0x00FFL) | ((v << 8) & 0xFF00L)); } @@ -382,7 +382,7 @@ template <> struct Pack::TypeInfo<uint32_t> : public Pack::Convertible { - static constexpr void convert(uint32_t &v) + static inline void convert(uint32_t &v) { v = ((((v) >> 24) & 0x000000FFL) | (((v) >> 8) & 0x0000FF00L) @@ -393,7 +393,7 @@ template <> struct Pack::TypeInfo<uint64_t> : public Pack::Convertible { - static constexpr void convert(uint64_t &v) + static inline void convert(uint64_t &v) { v = ((((v) & 0xff00000000000000ull) >> 56) | (((v) & 0x00ff000000000000ull) >> 40)
--- a/C++/Tests/Pack/main.cpp Thu Nov 13 21:04:28 2014 +0100 +++ b/C++/Tests/Pack/main.cpp Thu Nov 13 21:07:48 2014 +0100 @@ -28,6 +28,14 @@ uint32_t width{}; uint32_t height{}; + Point() = default; + + Point(uint32_t width, uint32_t height) + : width(width) + , height(height) + { + } + inline bool operator==(const Point &other) const { return width == other.width && height == other.height;