From f3c37e484e4762962c61faae56100584cccba60e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 8 Oct 2023 09:58:41 +0200 Subject: [PATCH] tag/Mask: add static_assert on the size of the mask --- src/tag/Mask.hxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tag/Mask.hxx b/src/tag/Mask.hxx index ee269b6e0..fc7ab77da 100644 --- a/src/tag/Mask.hxx +++ b/src/tag/Mask.hxx @@ -26,6 +26,11 @@ class TagMask { typedef uint_least32_t mask_t; + + /* the mask must have enough bits to represent all tags + supported by MPD */ + static_assert(TAG_NUM_OF_ITEM_TYPES <= sizeof(mask_t) * 8); + mask_t value; explicit constexpr TagMask(uint_least32_t _value) noexcept