util/drirc: turn on force_glsl_extensions_warn for No Mans Sky
[mesa.git] / src / util / bitset.h
index 7bb5f3c83cfdb811e00d426d6ef0a7ab6dee41a3..adafc72a5f74d46e118a1333cc84900f0e468932 100644 (file)
@@ -31,7 +31,8 @@
 #ifndef BITSET_H
 #define BITSET_H
 
-#include "util/u_math.h"
+#include "util/bitscan.h"
+#include "util/macros.h"
 
 /****************************************************************************
  * generic bitset implementation
@@ -142,23 +143,6 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
  * it as, and N is the number of bits in the bitset.
  */
 #define DECLARE_BITSET_T(T, N) struct T {                       \
-      /* XXX - Replace this with an implicitly-defined          \
-       * constructor when support for C++11 defaulted           \
-       * constructors can be assumed (available on GCC 4.4 and  \
-       * later) in order to make the object trivially           \
-       * constructible like a fundamental integer type for      \
-       * convenience.                                           \
-       */                                                       \
-      T()                                                       \
-      {                                                         \
-      }                                                         \
-                                                                \
-      T(BITSET_WORD x)                                          \
-      {                                                         \
-         for (unsigned i = 0; i < BITSET_WORDS(N); i++, x = 0)  \
-            words[i] = x;                                       \
-      }                                                         \
-                                                                \
       EXPLICIT_CONVERSION                                       \
       operator bool() const                                     \
       {                                                         \
@@ -168,6 +152,13 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
          return false;                                          \
       }                                                         \
                                                                 \
+      T &                                                       \
+      operator=(int x)                                          \
+      {                                                         \
+         const T c = {{ (BITSET_WORD)x }};                      \
+         return *this = c;                                      \
+      }                                                         \
+                                                                \
       friend bool                                               \
       operator==(const T &b, const T &c)                        \
       {                                                         \
@@ -180,6 +171,19 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
          return !(b == c);                                      \
       }                                                         \
                                                                 \
+      friend bool                                               \
+      operator==(const T &b, int x)                             \
+      {                                                         \
+         const T c = {{ (BITSET_WORD)x }};                      \
+         return b == c;                                         \
+      }                                                         \
+                                                                \
+      friend bool                                               \
+      operator!=(const T &b, int x)                             \
+      {                                                         \
+         return !(b == x);                                      \
+      }                                                         \
+                                                                \
       friend T                                                  \
       operator~(const T &b)                                     \
       {                                                         \