fixedbitset_stack/block/
default.rs1use core::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not};
2
3#[derive(Copy, Clone, PartialEq, Debug)]
4#[repr(transparent)]
5pub struct Block(pub(super) usize);
6
7impl Block {
8 #[inline]
9 pub const fn is_empty(self) -> bool {
10 self.0 == Self::NONE.0
11 }
12
13 #[inline]
14 pub fn andnot(self, other: Self) -> Self {
15 Self(!other.0 & self.0)
16 }
17}
18
19impl Not for Block {
20 type Output = Block;
21 #[inline]
22 fn not(self) -> Self::Output {
23 Self(self.0.not())
24 }
25}
26
27impl BitAnd for Block {
28 type Output = Block;
29 #[inline]
30 fn bitand(self, other: Self) -> Self::Output {
31 Self(self.0.bitand(other.0))
32 }
33}
34
35impl BitAndAssign for Block {
36 #[inline]
37 fn bitand_assign(&mut self, other: Self) {
38 self.0.bitand_assign(other.0);
39 }
40}
41
42impl BitOr for Block {
43 type Output = Block;
44 #[inline]
45 fn bitor(self, other: Self) -> Self::Output {
46 Self(self.0.bitor(other.0))
47 }
48}
49
50impl BitOrAssign for Block {
51 #[inline]
52 fn bitor_assign(&mut self, other: Self) {
53 self.0.bitor_assign(other.0)
54 }
55}
56
57impl BitXor for Block {
58 type Output = Block;
59 #[inline]
60 fn bitxor(self, other: Self) -> Self::Output {
61 Self(self.0.bitxor(other.0))
62 }
63}
64
65impl BitXorAssign for Block {
66 #[inline]
67 fn bitxor_assign(&mut self, other: Self) {
68 self.0.bitxor_assign(other.0)
69 }
70}