diff options
author | Jérôme Martinez <jerome@mediaarea.net> | 2022-10-01 23:29:22 +0300 |
---|---|---|
committer | Jérôme Martinez <jerome@mediaarea.net> | 2022-10-01 23:29:22 +0300 |
commit | 77e3c9cc66fd0eb2ab4a246c51d51cf16031f60e (patch) | |
tree | a64ac543daace1541d3bb93c6e3e17dbcb6a8cea | |
parent | b61fe1021bed4a80a6aa774648ff150384c0ad69 (diff) |
+ bitset8 additions
-rw-r--r-- | Source/MediaInfo/TimeCode.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/MediaInfo/TimeCode.h b/Source/MediaInfo/TimeCode.h index f9cd7fd3f..c61cd79c9 100644 --- a/Source/MediaInfo/TimeCode.h +++ b/Source/MediaInfo/TimeCode.h @@ -63,6 +63,9 @@ public: size_t const pos;
};
+ constexpr14 bitset8() : stored(0) {}
+ constexpr14 bitset8(int8u val) : stored(val) {}
+
constexpr14 bitset8& reset() noexcept
{
stored=0;
@@ -101,10 +104,32 @@ public: return test(pos);
}
+ constexpr14 int8u to_int8u() const noexcept
+ {
+ return stored;
+ }
+
+ constexpr14 explicit operator bool() const noexcept
+ {
+ return stored;
+ }
+
private:
int8u stored=0;
};
+inline int8u operator | (const bitset8 a, const bitset8 b) noexcept
+{
+ return a.to_int8u() | b.to_int8u();
+}
+
+inline int8u operator & (const bitset8 a, const bitset8 b) noexcept
+{
+ return a.to_int8u() & b.to_int8u();
+}
+
+
+
//***************************************************************************
// Class TimeCode
//***************************************************************************
|