summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Wasserka <NeoBrainX@gmail.com>2014-07-16 09:07:57 +0200
committerTony Wasserka <NeoBrainX@gmail.com>2014-07-16 09:08:19 +0200
commit15ab5382a553a47f21fe7283010ccdb342c0ead6 (patch)
tree3574ab838cf91b43a34642566b1d63e8368a1ac7 /src
parentBitField: Add an explicit evaluation method. (diff)
downloadyuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.tar
yuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.tar.gz
yuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.tar.bz2
yuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.tar.lz
yuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.tar.xz
yuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.tar.zst
yuzu-15ab5382a553a47f21fe7283010ccdb342c0ead6.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/bit_field.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index a39bb9886..c28e722c8 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -124,6 +124,22 @@ public:
// so that we can use this within unions
BitField() = default;
+#ifndef _WIN32
+ // We explicitly delete the copy assigment operator here, because the
+ // default copy assignment would copy the full storage value, rather than
+ // just the bits relevant to this particular bit field.
+ // Ideally, we would just implement the copy assignment to copy only the
+ // relevant bits, but this requires compiler support for unrestricted
+ // unions.
+ // MSVC 2013 has no support for this, hence we disable this code on
+ // Windows (so that the default copy assignment operator will be used).
+ // For any C++11 conformant compiler we delete the operator to make sure
+ // we never use this inappropriate operator to begin with.
+ // TODO: Implement this operator properly once all target compilers
+ // support unrestricted unions.
+ BitField& operator=(const BitField&) = delete;
+#endif
+
__forceinline BitField& operator=(T val)
{
storage = (storage & ~GetMask()) | ((val << position) & GetMask());