OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 { | 102 { |
103 if (numBits <= size()) | 103 if (numBits <= size()) |
104 return; | 104 return; |
105 resizeOutOfLine(numBits); | 105 resizeOutOfLine(numBits); |
106 } | 106 } |
107 | 107 |
108 // Like ensureSize(), but supports reducing the size of the bitvector. | 108 // Like ensureSize(), but supports reducing the size of the bitvector. |
109 void resize(size_t numBits); | 109 void resize(size_t numBits); |
110 | 110 |
111 void clearAll(); | 111 void clearAll(); |
| 112 void setAll(); |
112 | 113 |
113 bool quickGet(size_t bit) const | 114 bool quickGet(size_t bit) const |
114 { | 115 { |
115 ASSERT_WITH_SECURITY_IMPLICATION(bit < size()); | 116 ASSERT_WITH_SECURITY_IMPLICATION(bit < size()); |
116 return !!(bits()[bit / bitsInPointer()] & (static_cast<uintptr_t>(1) <<
(bit & (bitsInPointer() - 1)))); | 117 return !!(bits()[bit / bitsInPointer()] & (static_cast<uintptr_t>(1) <<
(bit & (bitsInPointer() - 1)))); |
117 } | 118 } |
118 | 119 |
119 void quickSet(size_t bit) | 120 void quickSet(size_t bit) |
120 { | 121 { |
121 ASSERT_WITH_SECURITY_IMPLICATION(bit < size()); | 122 ASSERT_WITH_SECURITY_IMPLICATION(bit < size()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 238 } |
238 | 239 |
239 uintptr_t m_bitsOrPointer; | 240 uintptr_t m_bitsOrPointer; |
240 }; | 241 }; |
241 | 242 |
242 } // namespace WTF | 243 } // namespace WTF |
243 | 244 |
244 using WTF::BitVector; | 245 using WTF::BitVector; |
245 | 246 |
246 #endif // BitVector_h | 247 #endif // BitVector_h |
OLD | NEW |