From 16c03fd756a6c39270073883da1aed3c8c20a7b8 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 27 Mar 2023 23:35:57 +0200 Subject: [PATCH] aco/util: override default assignment operator for bitfield helpers Otherwise, the default assignment operator copies the whole uint, not just few bits we are interested in. Reviewed-by: Rhys Perry Fixes: e7559da7570 ("aco: add bitfield array helper classes") Part-of: --- src/amd/compiler/aco_util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/amd/compiler/aco_util.h b/src/amd/compiler/aco_util.h index c96080c..ce29c0f 100644 --- a/src/amd/compiler/aco_util.h +++ b/src/amd/compiler/aco_util.h @@ -631,6 +631,11 @@ public: return *this; } + constexpr bitfield_uint& operator=(const bitfield_uint& value) + { + return *this = access_type(value); + } + constexpr bitfield_uint& operator|=(const access_type& value) { storage |= data_type(value & mask) << offset; @@ -940,6 +945,11 @@ public: return *this; } + constexpr bitfield_array& operator=(const bitfield_array& value) + { + return *this = access_type(value); + } + constexpr reference operator[](unsigned index) { assert(index < size); -- 2.7.4