Commit a6572861 authored by aligungr's avatar aligungr

OctetView refactor

parent 31337c43
...@@ -42,7 +42,7 @@ struct octet ...@@ -42,7 +42,7 @@ struct octet
return static_cast<int32_t>(value); return static_cast<int32_t>(value);
} }
inline bool bit(int index) const [[nodiscard]] inline bool bit(int index) const
{ {
assert(index >= 0 && index <= 7); assert(index >= 0 && index <= 7);
std::bitset<8> bitset = value; std::bitset<8> bitset = value;
...@@ -93,11 +93,6 @@ struct octet2 ...@@ -93,11 +93,6 @@ struct octet2
{ {
return value; return value;
} }
explicit constexpr operator int16_t() const
{
return static_cast<uint16_t>(value);
}
}; };
struct octet3 struct octet3
...@@ -171,15 +166,20 @@ struct octet4 ...@@ -171,15 +166,20 @@ struct octet4
return (value >> (24 - index * 8)) & 0xFF; return (value >> (24 - index * 8)) & 0xFF;
} }
explicit constexpr operator int32_t() const inline explicit constexpr operator int32_t() const
{ {
return static_cast<int32_t>(value); return static_cast<int32_t>(value);
} }
explicit constexpr operator uint32_t() const inline explicit constexpr operator uint32_t() const
{ {
return value; return value;
} }
inline bool operator==(const octet4 &other) const
{
return value == other.value;
}
}; };
struct octet8 struct octet8
......
...@@ -63,11 +63,6 @@ class OctetView ...@@ -63,11 +63,6 @@ class OctetView
return octet2{read(), read()}; return octet2{read(), read()};
} }
inline int16_t read2S() const
{
return (int16_t)read2();
}
inline uint16_t read2US() const inline uint16_t read2US() const
{ {
return (uint16_t)read2(); return (uint16_t)read2();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment