File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,23 @@ impl FixedBitSet {
217217 }
218218 }
219219
220+ /// Disable `bit`.
221+ ///
222+ /// **Panics** if **bit** is out of bounds.
223+ #[ inline]
224+ pub fn remove ( & mut self , bit : usize ) {
225+ assert ! (
226+ bit < self . length,
227+ "remove at index {} exceeds fixbitset size {}" ,
228+ bit,
229+ self . length
230+ ) ;
231+ let ( block, i) = div_rem ( bit) ;
232+ unsafe {
233+ * self . data . get_unchecked_mut ( block) &= !( 1 << i) ;
234+ }
235+ }
236+
220237 /// Enable `bit`, and return its previous value.
221238 ///
222239 /// **Panics** if **bit** is out of bounds.
@@ -236,6 +253,7 @@ impl FixedBitSet {
236253 prev
237254 }
238255 }
256+
239257 /// Toggle `bit` (inverting its state).
240258 ///
241259 /// ***Panics*** if **bit** is out of bounds
@@ -252,6 +270,7 @@ impl FixedBitSet {
252270 * self . data . get_unchecked_mut ( block) ^= 1 << i;
253271 }
254272 }
273+
255274 /// **Panics** if **bit** is out of bounds.
256275 #[ inline]
257276 pub fn set ( & mut self , bit : usize , enabled : bool ) {
You can’t perform that action at this time.
0 commit comments