Module: Mesa
Branch: main
Commit: 16c03fd756a6c39270073883da1aed3c8c20a7b8
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16c03fd756a6c39270073883da1aed3c8c20a7b8

Author: Georg Lehmann <[email protected]>
Date:   Mon Mar 27 23:35:57 2023 +0200

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 <[email protected]>
Fixes: e7559da7570 ("aco: add bitfield array helper classes")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22154>

---

 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 c96080ca0d5..ce29c0f7ac8 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);

Reply via email to