diff --git a/src/common/types.h b/src/common/types.h
index 7bd0e494c..a5b33c021 100644
--- a/src/common/types.h
+++ b/src/common/types.h
@@ -232,42 +232,3 @@ ALWAYS_INLINE constexpr T SignExtendN(T value)
                              static_cast<std::underlying_type<type_>::type>(rhs));                                     \
     return lhs;                                                                                                        \
   }
-
-#define IMPLEMENT_STATIC_FRIEND_ENUM_CLASS_BITWISE_OPERATORS(type_)                                                                  \
-  ALWAYS_INLINE constexpr static friend type_ operator&(type_ lhs, type_ rhs)                                                               \
-  {                                                                                                                    \
-    return static_cast<type_>(static_cast<std::underlying_type<type_>::type>(lhs) &                                    \
-                              static_cast<std::underlying_type<type_>::type>(rhs));                                    \
-  }                                                                                                                    \
-  ALWAYS_INLINE constexpr static friend type_ operator|(type_ lhs, type_ rhs)                                                               \
-  {                                                                                                                    \
-    return static_cast<type_>(static_cast<std::underlying_type<type_>::type>(lhs) |                                    \
-                              static_cast<std::underlying_type<type_>::type>(rhs));                                    \
-  }                                                                                                                    \
-  ALWAYS_INLINE constexpr static friend type_ operator^(type_ lhs, type_ rhs)                                                               \
-  {                                                                                                                    \
-    return static_cast<type_>(static_cast<std::underlying_type<type_>::type>(lhs) ^                                    \
-                              static_cast<std::underlying_type<type_>::type>(rhs));                                    \
-  }                                                                                                                    \
-  ALWAYS_INLINE constexpr static friend type_ operator~(type_ val)                                                                          \
-  {                                                                                                                    \
-    return static_cast<type_>(~static_cast<std::underlying_type<type_>::type>(val));                                   \
-  }                                                                                                                    \
-  ALWAYS_INLINE constexpr static friend type_& operator&=(type_& lhs, type_ rhs)                                                            \
-  {                                                                                                                    \
-    lhs = static_cast<type_>(static_cast<std::underlying_type<type_>::type>(lhs) &                                     \
-                             static_cast<std::underlying_type<type_>::type>(rhs));                                     \
-    return lhs;                                                                                                        \
-  }                                                                                                                    \
-  ALWAYS_INLINE constexpr static friend type_& operator|=(type_& lhs, type_ rhs)                                                            \
-  {                                                                                                                    \
-    lhs = static_cast<type_>(static_cast<std::underlying_type<type_>::type>(lhs) |                                     \
-                             static_cast<std::underlying_type<type_>::type>(rhs));                                     \
-    return lhs;                                                                                                        \
-  }                                                                                                                    \
-  ALWAYS_INLINE constexpr static friend type_& operator^=(type_& lhs, type_ rhs)                                                            \
-  {                                                                                                                    \
-    lhs = static_cast<type_>(static_cast<std::underlying_type<type_>::type>(lhs) ^                                     \
-                             static_cast<std::underlying_type<type_>::type>(rhs));                                     \
-    return lhs;                                                                                                        \
-  }
diff --git a/src/core/gpu.h b/src/core/gpu.h
index 85a4d40d6..b781169a1 100644
--- a/src/core/gpu.h
+++ b/src/core/gpu.h
@@ -153,8 +153,6 @@ protected:
     Disabled = 8 // Not a register value
   };
 
-  IMPLEMENT_STATIC_FRIEND_ENUM_CLASS_BITWISE_OPERATORS(TextureMode);
-
   enum class TransparencyMode : u8
   {
     HalfBackgroundPlusHalfForeground = 0,
diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp
index e983bbace..b43b48ad8 100644
--- a/src/core/gpu_hw.cpp
+++ b/src/core/gpu_hw.cpp
@@ -261,8 +261,10 @@ void main()
 
 std::string GPU_HW::GenerateFragmentShader(HWBatchRenderMode transparency, TextureMode texture_mode, bool dithering)
 {
-  const TextureMode actual_texture_mode = texture_mode & ~TextureMode::RawTextureBit;
-  const bool raw_texture = (texture_mode & TextureMode::RawTextureBit) == TextureMode::RawTextureBit;
+  const TextureMode actual_texture_mode =
+    static_cast<TextureMode>(static_cast<u8>(texture_mode) & ~static_cast<u8>(TextureMode::RawTextureBit));
+  const bool raw_texture = (static_cast<u8>(texture_mode) & static_cast<u8>(TextureMode::RawTextureBit)) ==
+                           static_cast<u8>(TextureMode::RawTextureBit);
 
   std::stringstream ss;
   GenerateShaderHeader(ss);
@@ -620,7 +622,10 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
 
     texture_mode = m_render_state.texture_color_mode;
     if (rc.raw_texture_enable)
-      texture_mode |= TextureMode::RawTextureBit;
+    {
+      texture_mode =
+        static_cast<TextureMode>(static_cast<u8>(texture_mode) | static_cast<u8>(TextureMode::RawTextureBit));
+    }
   }
   else
   {