OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 return (bits_ & set.bits_) != 0; | 1023 return (bits_ & set.bits_) != 0; |
1024 } | 1024 } |
1025 void Add(E element) { bits_ |= Mask(element); } | 1025 void Add(E element) { bits_ |= Mask(element); } |
1026 void Add(const EnumSet& set) { bits_ |= set.bits_; } | 1026 void Add(const EnumSet& set) { bits_ |= set.bits_; } |
1027 void Remove(E element) { bits_ &= ~Mask(element); } | 1027 void Remove(E element) { bits_ &= ~Mask(element); } |
1028 void Remove(const EnumSet& set) { bits_ &= ~set.bits_; } | 1028 void Remove(const EnumSet& set) { bits_ &= ~set.bits_; } |
1029 void RemoveAll() { bits_ = 0; } | 1029 void RemoveAll() { bits_ = 0; } |
1030 void Intersect(const EnumSet& set) { bits_ &= set.bits_; } | 1030 void Intersect(const EnumSet& set) { bits_ &= set.bits_; } |
1031 T ToIntegral() const { return bits_; } | 1031 T ToIntegral() const { return bits_; } |
1032 bool operator==(const EnumSet& set) { return bits_ == set.bits_; } | 1032 bool operator==(const EnumSet& set) { return bits_ == set.bits_; } |
| 1033 bool operator!=(const EnumSet& set) { return bits_ != set.bits_; } |
1033 EnumSet<E, T> operator|(const EnumSet& set) const { | 1034 EnumSet<E, T> operator|(const EnumSet& set) const { |
1034 return EnumSet<E, T>(bits_ | set.bits_); | 1035 return EnumSet<E, T>(bits_ | set.bits_); |
1035 } | 1036 } |
1036 | 1037 |
1037 private: | 1038 private: |
1038 T Mask(E element) const { | 1039 T Mask(E element) const { |
1039 // The strange typing in ASSERT is necessary to avoid stupid warnings, see: | 1040 // The strange typing in ASSERT is necessary to avoid stupid warnings, see: |
1040 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680 | 1041 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680 |
1041 ASSERT(static_cast<int>(element) < static_cast<int>(sizeof(T) * CHAR_BIT)); | 1042 ASSERT(static_cast<int>(element) < static_cast<int>(sizeof(T) * CHAR_BIT)); |
1042 return 1 << element; | 1043 return 1 << element; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 | 1092 |
1092 // Every compiled stub starts with this id. | 1093 // Every compiled stub starts with this id. |
1093 static const int kStubEntryId = 5; | 1094 static const int kStubEntryId = 5; |
1094 | 1095 |
1095 int id_; | 1096 int id_; |
1096 }; | 1097 }; |
1097 | 1098 |
1098 } } // namespace v8::internal | 1099 } } // namespace v8::internal |
1099 | 1100 |
1100 #endif // V8_UTILS_H_ | 1101 #endif // V8_UTILS_H_ |
OLD | NEW |