From 773994020265b0bbaec16b81514a4e474b47e7d2 Mon Sep 17 00:00:00 2001 From: Riteo Date: Thu, 1 Feb 2024 20:10:30 +0100 Subject: [PATCH] Core: Implement a XOR operator for BitField --- core/variant/type_info.h | 1 + platform/linuxbsd/wayland/wayland_thread.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/variant/type_info.h b/core/variant/type_info.h index c1f2f86a963c..00075b1cb784 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -300,6 +300,7 @@ class BitField { _FORCE_INLINE_ constexpr BitField(T p_value) { value = (int64_t)p_value; } _FORCE_INLINE_ operator int64_t() const { return value; } _FORCE_INLINE_ operator Variant() const { return value; } + _FORCE_INLINE_ BitField operator^(const BitField &p_b) const { return BitField(value ^ p_b.value); } }; #define TEMPL_MAKE_BITFIELD_TYPE_INFO(m_enum, m_impl) \ diff --git a/platform/linuxbsd/wayland/wayland_thread.cpp b/platform/linuxbsd/wayland/wayland_thread.cpp index 7e96f2dd759c..5eca4f00b324 100644 --- a/platform/linuxbsd/wayland/wayland_thread.cpp +++ b/platform/linuxbsd/wayland/wayland_thread.cpp @@ -1555,7 +1555,7 @@ void WaylandThread::_wl_pointer_on_frame(void *data, struct wl_pointer *wl_point } if (old_pd.pressed_button_mask != pd.pressed_button_mask) { - BitField pressed_mask_delta = BitField((uint32_t)old_pd.pressed_button_mask ^ (uint32_t)pd.pressed_button_mask); + BitField pressed_mask_delta = old_pd.pressed_button_mask ^ pd.pressed_button_mask; const MouseButton buttons_to_test[] = { MouseButton::LEFT,