Skip to content

Commit

Permalink
util/PacketBigEndian: add operator|
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Feb 1, 2025
1 parent 00a352f commit 6b92b7a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/util/PackedBigEndian.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ public:
x = ByteSwap32(x);
return x;
}

constexpr auto operator|(PackedBE32 other) noexcept {
PackedBE32 result{};
result.a = a|other.a;
result.b = b|other.b;
result.c = c|other.c;
result.d = d|other.d;
return result;
}

constexpr auto &operator|=(PackedBE32 x) noexcept {
return *this = *this | x;
}
};

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

0 comments on commit 6b92b7a

Please sign in to comment.