Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
Jamie Madill | 20e005b | 2017-04-07 14:19:22 -0400 | [diff] [blame] | 6 | // bitset_utils: |
| 7 | // Bitset-related helper classes, such as a fast iterator to scan for set bits. |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 8 | // |
| 9 | |
| 10 | #ifndef COMMON_BITSETITERATOR_H_ |
| 11 | #define COMMON_BITSETITERATOR_H_ |
| 12 | |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | #include <bitset> |
| 16 | |
| 17 | #include "common/angleutils.h" |
| 18 | #include "common/debug.h" |
| 19 | #include "common/mathutil.h" |
| 20 | #include "common/platform.h" |
| 21 | |
| 22 | namespace angle |
| 23 | { |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 24 | |
| 25 | template <size_t N, typename BitsT> |
| 26 | class BitSetT final |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 27 | { |
| 28 | public: |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 29 | class Reference final |
| 30 | { |
| 31 | public: |
| 32 | ~Reference() {} |
| 33 | Reference &operator=(bool x) { mParent->set(mBit, x); } |
| 34 | operator bool() const { return mParent->test(mBit); } |
| 35 | |
| 36 | private: |
| 37 | friend class BitSetT; |
| 38 | |
| 39 | Reference(BitSetT *parent, std::size_t bit) : mParent(parent), mBit(bit) {} |
| 40 | |
| 41 | BitSetT *mParent; |
| 42 | std::size_t mBit; |
| 43 | }; |
| 44 | |
| 45 | class Iterator final |
| 46 | { |
| 47 | public: |
| 48 | Iterator(const BitSetT &bits); |
| 49 | Iterator &operator++(); |
| 50 | |
| 51 | bool operator==(const Iterator &other) const; |
| 52 | bool operator!=(const Iterator &other) const; |
| 53 | std::size_t operator*() const; |
| 54 | |
| 55 | private: |
| 56 | std::size_t getNextBit(); |
| 57 | |
| 58 | BitSetT mBitsCopy; |
| 59 | std::size_t mCurrentBit; |
| 60 | }; |
| 61 | |
| 62 | BitSetT(); |
| 63 | BitSetT(BitsT value); |
| 64 | ~BitSetT(); |
| 65 | |
| 66 | BitSetT(const BitSetT &other); |
| 67 | BitSetT &operator=(const BitSetT &other); |
| 68 | |
| 69 | bool operator==(const BitSetT &other) const; |
| 70 | bool operator!=(const BitSetT &other) const; |
| 71 | |
| 72 | constexpr bool operator[](std::size_t pos) const; |
| 73 | Reference operator[](std::size_t pos) { return Reference(this, pos); } |
| 74 | |
| 75 | bool test(std::size_t pos) const; |
| 76 | |
| 77 | bool all() const; |
| 78 | bool any() const; |
| 79 | bool none() const; |
| 80 | std::size_t count() const; |
| 81 | |
| 82 | constexpr std::size_t size() const { return N; } |
| 83 | |
| 84 | BitSetT &operator&=(const BitSetT &other); |
| 85 | BitSetT &operator|=(const BitSetT &other); |
| 86 | BitSetT &operator^=(const BitSetT &other); |
| 87 | BitSetT operator~() const; |
| 88 | |
| 89 | BitSetT operator<<(std::size_t pos) const; |
| 90 | BitSetT &operator<<=(std::size_t pos); |
| 91 | BitSetT operator>>(std::size_t pos) const; |
| 92 | BitSetT &operator>>=(std::size_t pos); |
| 93 | |
| 94 | BitSetT &set(); |
| 95 | BitSetT &set(std::size_t pos, bool value = true); |
| 96 | |
| 97 | BitSetT &reset(); |
| 98 | BitSetT &reset(std::size_t pos); |
| 99 | |
| 100 | BitSetT &flip(); |
| 101 | BitSetT &flip(std::size_t pos); |
| 102 | |
| 103 | unsigned long to_ulong() const { return static_cast<unsigned long>(mBits); } |
| 104 | BitsT bits() const { return mBits; } |
| 105 | |
| 106 | Iterator begin() const { return Iterator(*this); } |
| 107 | Iterator end() const { return Iterator(BitSetT()); } |
| 108 | |
| 109 | private: |
| 110 | constexpr static BitsT Bit(std::size_t x) { return (static_cast<BitsT>(1) << x); } |
| 111 | constexpr static BitsT Mask(std::size_t x) { return ((Bit(x - 1) - 1) << 1) + 1; } |
| 112 | |
| 113 | BitsT mBits; |
| 114 | }; |
| 115 | |
| 116 | template <size_t N> |
| 117 | class IterableBitSet : public std::bitset<N> |
| 118 | { |
| 119 | public: |
| 120 | IterableBitSet() {} |
| 121 | IterableBitSet(const std::bitset<N> &implicitBitSet) : std::bitset<N>(implicitBitSet) {} |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 122 | |
| 123 | class Iterator final |
| 124 | { |
| 125 | public: |
| 126 | Iterator(const std::bitset<N> &bits); |
| 127 | Iterator &operator++(); |
| 128 | |
| 129 | bool operator==(const Iterator &other) const; |
| 130 | bool operator!=(const Iterator &other) const; |
| 131 | unsigned long operator*() const { return mCurrentBit; } |
| 132 | |
| 133 | private: |
| 134 | unsigned long getNextBit(); |
| 135 | |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 136 | static constexpr size_t BitsPerWord = sizeof(uint32_t) * 8; |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 137 | std::bitset<N> mBits; |
| 138 | unsigned long mCurrentBit; |
| 139 | unsigned long mOffset; |
| 140 | }; |
| 141 | |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 142 | Iterator begin() const { return Iterator(*this); } |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 143 | Iterator end() const { return Iterator(std::bitset<N>(0)); } |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | template <size_t N> |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 147 | IterableBitSet<N>::Iterator::Iterator(const std::bitset<N> &bitset) |
| 148 | : mBits(bitset), mCurrentBit(0), mOffset(0) |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 149 | { |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 150 | if (mBits.any()) |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 151 | { |
| 152 | mCurrentBit = getNextBit(); |
| 153 | } |
| 154 | else |
| 155 | { |
Cooper Partin | 4d61f7e | 2015-08-12 10:56:50 -0700 | [diff] [blame] | 156 | mOffset = static_cast<unsigned long>(rx::roundUp(N, BitsPerWord)); |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 157 | } |
| 158 | } |
| 159 | |
| 160 | template <size_t N> |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 161 | typename IterableBitSet<N>::Iterator &IterableBitSet<N>::Iterator::operator++() |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 162 | { |
| 163 | ASSERT(mBits.any()); |
| 164 | mBits.set(mCurrentBit - mOffset, 0); |
| 165 | mCurrentBit = getNextBit(); |
| 166 | return *this; |
| 167 | } |
| 168 | |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 169 | template <size_t N> |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 170 | bool IterableBitSet<N>::Iterator::operator==(const Iterator &other) const |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 171 | { |
| 172 | return mOffset == other.mOffset && mBits == other.mBits; |
| 173 | } |
| 174 | |
| 175 | template <size_t N> |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 176 | bool IterableBitSet<N>::Iterator::operator!=(const Iterator &other) const |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 177 | { |
| 178 | return !(*this == other); |
| 179 | } |
| 180 | |
| 181 | template <size_t N> |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 182 | unsigned long IterableBitSet<N>::Iterator::getNextBit() |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 183 | { |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 184 | // TODO(jmadill): Use 64-bit scan when possible. |
| 185 | static constexpr std::bitset<N> wordMask(std::numeric_limits<uint32_t>::max()); |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 186 | |
| 187 | while (mOffset < N) |
| 188 | { |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 189 | uint32_t wordBits = static_cast<uint32_t>((mBits & wordMask).to_ulong()); |
| 190 | if (wordBits != 0) |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 191 | { |
Olli Etuaho | 9250cb2 | 2017-01-21 10:51:27 +0000 | [diff] [blame] | 192 | return gl::ScanForward(wordBits) + mOffset; |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | mBits >>= BitsPerWord; |
| 196 | mOffset += BitsPerWord; |
| 197 | } |
| 198 | return 0; |
| 199 | } |
| 200 | |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 201 | template <size_t N, typename BitsT> |
| 202 | BitSetT<N, BitsT>::BitSetT() : mBits(0) |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 203 | { |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 204 | static_assert(N > 0, "Bitset type cannot support zero bits."); |
| 205 | static_assert(N <= sizeof(BitsT) * 8, "Bitset type cannot support a size this large."); |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 206 | } |
| 207 | |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 208 | template <size_t N, typename BitsT> |
| 209 | BitSetT<N, BitsT>::BitSetT(BitsT value) : mBits(value & Mask(N)) |
| 210 | { |
| 211 | } |
| 212 | |
| 213 | template <size_t N, typename BitsT> |
| 214 | BitSetT<N, BitsT>::~BitSetT() |
| 215 | { |
| 216 | } |
| 217 | |
| 218 | template <size_t N, typename BitsT> |
| 219 | BitSetT<N, BitsT>::BitSetT(const BitSetT &other) : mBits(other.mBits) |
| 220 | { |
| 221 | } |
| 222 | |
| 223 | template <size_t N, typename BitsT> |
| 224 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator=(const BitSetT &other) |
| 225 | { |
| 226 | mBits = other.mBits; |
| 227 | return *this; |
| 228 | } |
| 229 | |
| 230 | template <size_t N, typename BitsT> |
| 231 | bool BitSetT<N, BitsT>::operator==(const BitSetT &other) const |
| 232 | { |
| 233 | return mBits == other.mBits; |
| 234 | } |
| 235 | |
| 236 | template <size_t N, typename BitsT> |
| 237 | bool BitSetT<N, BitsT>::operator!=(const BitSetT &other) const |
| 238 | { |
| 239 | return mBits != other.mBits; |
| 240 | } |
| 241 | |
| 242 | template <size_t N, typename BitsT> |
| 243 | constexpr bool BitSetT<N, BitsT>::operator[](std::size_t pos) const |
| 244 | { |
| 245 | return test(pos); |
| 246 | } |
| 247 | |
| 248 | template <size_t N, typename BitsT> |
| 249 | bool BitSetT<N, BitsT>::test(std::size_t pos) const |
| 250 | { |
| 251 | return (mBits & Bit(pos)) != 0; |
| 252 | } |
| 253 | |
| 254 | template <size_t N, typename BitsT> |
| 255 | bool BitSetT<N, BitsT>::all() const |
| 256 | { |
| 257 | ASSERT(mBits == (mBits & Mask(N))); |
| 258 | return mBits == Mask(N); |
| 259 | } |
| 260 | |
| 261 | template <size_t N, typename BitsT> |
| 262 | bool BitSetT<N, BitsT>::any() const |
| 263 | { |
| 264 | ASSERT(mBits == (mBits & Mask(N))); |
| 265 | return (mBits != 0); |
| 266 | } |
| 267 | |
| 268 | template <size_t N, typename BitsT> |
| 269 | bool BitSetT<N, BitsT>::none() const |
| 270 | { |
| 271 | ASSERT(mBits == (mBits & Mask(N))); |
| 272 | return (mBits == 0); |
| 273 | } |
| 274 | |
| 275 | template <size_t N, typename BitsT> |
| 276 | std::size_t BitSetT<N, BitsT>::count() const |
| 277 | { |
| 278 | return gl::BitCount(mBits); |
| 279 | } |
| 280 | |
| 281 | template <size_t N, typename BitsT> |
| 282 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator&=(const BitSetT &other) |
| 283 | { |
| 284 | mBits &= other.mBits; |
| 285 | return *this; |
| 286 | } |
| 287 | |
| 288 | template <size_t N, typename BitsT> |
| 289 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator|=(const BitSetT &other) |
| 290 | { |
| 291 | mBits |= other.mBits; |
| 292 | return *this; |
| 293 | } |
| 294 | |
| 295 | template <size_t N, typename BitsT> |
| 296 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator^=(const BitSetT &other) |
| 297 | { |
| 298 | mBits = (mBits ^ other.mBits) & Mask(N); |
| 299 | return *this; |
| 300 | } |
| 301 | |
| 302 | template <size_t N, typename BitsT> |
| 303 | BitSetT<N, BitsT> BitSetT<N, BitsT>::operator~() const |
| 304 | { |
| 305 | return BitSetT<N, BitsT>(~mBits & Mask(N)); |
| 306 | } |
| 307 | |
| 308 | template <size_t N, typename BitsT> |
| 309 | BitSetT<N, BitsT> BitSetT<N, BitsT>::operator<<(std::size_t pos) const |
| 310 | { |
| 311 | return BitSetT<N, BitsT>((mBits << pos) & Mask(N)); |
| 312 | } |
| 313 | |
| 314 | template <size_t N, typename BitsT> |
| 315 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator<<=(std::size_t pos) |
| 316 | { |
| 317 | mBits = (mBits << pos & Mask(N)); |
| 318 | return *this; |
| 319 | } |
| 320 | |
| 321 | template <size_t N, typename BitsT> |
| 322 | BitSetT<N, BitsT> BitSetT<N, BitsT>::operator>>(std::size_t pos) const |
| 323 | { |
| 324 | return BitSetT<N, BitsT>(mBits >> pos); |
| 325 | } |
| 326 | |
| 327 | template <size_t N, typename BitsT> |
| 328 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator>>=(std::size_t pos) |
| 329 | { |
| 330 | mBits = ((mBits >> pos) & Mask(N)); |
| 331 | return *this; |
| 332 | } |
| 333 | |
| 334 | template <size_t N, typename BitsT> |
| 335 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::set() |
| 336 | { |
| 337 | mBits = Mask(N); |
| 338 | return *this; |
| 339 | } |
| 340 | |
| 341 | template <size_t N, typename BitsT> |
| 342 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::set(std::size_t pos, bool value) |
| 343 | { |
| 344 | if (value) |
| 345 | { |
| 346 | mBits |= Bit(pos); |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | reset(pos); |
| 351 | } |
| 352 | return *this; |
| 353 | } |
| 354 | |
| 355 | template <size_t N, typename BitsT> |
| 356 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::reset() |
| 357 | { |
| 358 | mBits = 0; |
| 359 | return *this; |
| 360 | } |
| 361 | |
| 362 | template <size_t N, typename BitsT> |
| 363 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::reset(std::size_t pos) |
| 364 | { |
| 365 | mBits &= ~Bit(pos); |
| 366 | return *this; |
| 367 | } |
| 368 | |
| 369 | template <size_t N, typename BitsT> |
| 370 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::flip() |
| 371 | { |
| 372 | mBits ^= Mask(N); |
| 373 | return *this; |
| 374 | } |
| 375 | |
| 376 | template <size_t N, typename BitsT> |
| 377 | BitSetT<N, BitsT> &BitSetT<N, BitsT>::flip(std::size_t pos) |
| 378 | { |
| 379 | mBits ^= Bit(pos); |
| 380 | return *this; |
| 381 | } |
| 382 | |
| 383 | template <size_t N, typename BitsT> |
| 384 | BitSetT<N, BitsT>::Iterator::Iterator(const BitSetT &bits) : mBitsCopy(bits), mCurrentBit(0) |
| 385 | { |
| 386 | if (bits.any()) |
| 387 | { |
| 388 | mCurrentBit = getNextBit(); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | template <size_t N, typename BitsT> |
| 393 | typename BitSetT<N, BitsT>::Iterator &BitSetT<N, BitsT>::Iterator::operator++() |
| 394 | { |
| 395 | ASSERT(mBitsCopy.any()); |
| 396 | mBitsCopy.reset(mCurrentBit); |
| 397 | mCurrentBit = getNextBit(); |
| 398 | return *this; |
| 399 | } |
| 400 | |
| 401 | template <size_t N, typename BitsT> |
| 402 | bool BitSetT<N, BitsT>::Iterator::operator==(const Iterator &other) const |
| 403 | { |
| 404 | return mBitsCopy == other.mBitsCopy; |
| 405 | } |
| 406 | |
| 407 | template <size_t N, typename BitsT> |
| 408 | bool BitSetT<N, BitsT>::Iterator::operator!=(const Iterator &other) const |
| 409 | { |
| 410 | return !(*this == other); |
| 411 | } |
| 412 | |
| 413 | template <size_t N, typename BitsT> |
| 414 | std::size_t BitSetT<N, BitsT>::Iterator::operator*() const |
| 415 | { |
| 416 | return mCurrentBit; |
| 417 | } |
| 418 | |
| 419 | template <size_t N, typename BitsT> |
| 420 | std::size_t BitSetT<N, BitsT>::Iterator::getNextBit() |
| 421 | { |
| 422 | if (mBitsCopy.none()) |
| 423 | { |
| 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | return gl::ScanForward(mBitsCopy.mBits); |
| 428 | } |
| 429 | |
| 430 | template <size_t N> |
| 431 | using BitSet32 = BitSetT<N, uint32_t>; |
| 432 | |
| 433 | // ScanForward for 64-bits requires a 64-bit implementation. |
| 434 | #if defined(ANGLE_X64_CPU) |
| 435 | template <size_t N> |
| 436 | using BitSet64 = BitSetT<N, uint64_t>; |
| 437 | #endif // defined(ANGLE_X64_CPU) |
| 438 | |
| 439 | namespace priv |
| 440 | { |
| 441 | |
| 442 | template <size_t N, typename T> |
| 443 | using EnableIfBitsFit = typename std::enable_if<N <= sizeof(T) * 8>::type; |
| 444 | |
| 445 | template <size_t N, typename Enable = void> |
| 446 | struct GetBitSet |
| 447 | { |
| 448 | using Type = IterableBitSet<N>; |
| 449 | }; |
| 450 | |
| 451 | // Prefer 64-bit bitsets on 64-bit CPUs. They seem faster than 32-bit. |
| 452 | #if defined(ANGLE_X64_CPU) |
| 453 | template <size_t N> |
| 454 | struct GetBitSet<N, EnableIfBitsFit<N, uint64_t>> |
| 455 | { |
| 456 | using Type = BitSet64<N>; |
| 457 | }; |
| 458 | #else |
| 459 | template <size_t N> |
| 460 | struct GetBitSet<N, EnableIfBitsFit<N, uint32_t>> |
| 461 | { |
| 462 | using Type = BitSet32<N>; |
| 463 | }; |
| 464 | #endif // defined(ANGLE_X64_CPU) |
| 465 | |
| 466 | } // namespace priv |
| 467 | |
| 468 | template <size_t N> |
| 469 | using BitSet = typename priv::GetBitSet<N>::Type; |
| 470 | |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 471 | } // angle |
| 472 | |
Jamie Madill | 6de5185 | 2017-04-12 09:53:01 -0400 | [diff] [blame^] | 473 | template <size_t N, typename BitsT> |
| 474 | inline angle::BitSetT<N, BitsT> operator&(const angle::BitSetT<N, BitsT> &lhs, |
| 475 | const angle::BitSetT<N, BitsT> &rhs) |
| 476 | { |
| 477 | return angle::BitSetT<N, BitsT>(lhs.bits() & rhs.bits()); |
| 478 | } |
| 479 | |
| 480 | template <size_t N, typename BitsT> |
| 481 | inline angle::BitSetT<N, BitsT> operator|(const angle::BitSetT<N, BitsT> &lhs, |
| 482 | const angle::BitSetT<N, BitsT> &rhs) |
| 483 | { |
| 484 | return angle::BitSetT<N, BitsT>(lhs.bits() | rhs.bits()); |
| 485 | } |
| 486 | |
| 487 | template <size_t N, typename BitsT> |
| 488 | inline angle::BitSetT<N, BitsT> operator^(const angle::BitSetT<N, BitsT> &lhs, |
| 489 | const angle::BitSetT<N, BitsT> &rhs) |
| 490 | { |
| 491 | return angle::BitSetT<N, BitsT>(lhs.bits() ^ rhs.bits()); |
| 492 | } |
| 493 | |
Jamie Madill | 6b2a0b0 | 2015-08-03 14:15:08 -0400 | [diff] [blame] | 494 | #endif // COMMON_BITSETITERATOR_H_ |