Skip to content

Commit 6b92b7a

Browse files
committed
util/PacketBigEndian: add operator|
1 parent 00a352f commit 6b92b7a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/util/PackedBigEndian.hxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ public:
111111
x = ByteSwap32(x);
112112
return x;
113113
}
114+
115+
constexpr auto operator|(PackedBE32 other) noexcept {
116+
PackedBE32 result{};
117+
result.a = a|other.a;
118+
result.b = b|other.b;
119+
result.c = c|other.c;
120+
result.d = d|other.d;
121+
return result;
122+
}
123+
124+
constexpr auto &operator|=(PackedBE32 x) noexcept {
125+
return *this = *this | x;
126+
}
114127
};
115128

116129
static_assert(sizeof(PackedBE32) == sizeof(uint32_t), "Wrong size");

0 commit comments

Comments
 (0)