Skip to content

Commit b90267e

Browse files
committed
lit: Cleanup and missing docs
1 parent ed3e5e9 commit b90267e

File tree

3 files changed

+13
-27
lines changed

3 files changed

+13
-27
lines changed

ir/src/var.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
//! Numeric identifiers for variables and Boolean literals
2-
pub use imctk_lit::{lit::Lit, pol::Pol, var::Var};
2+
pub use imctk_lit::{Lit, Pol, Var};

lit/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Numeric identifiers for variables and Boolean literals
2-
#![allow(missing_docs, dead_code)] // FIXME prototyping
2+
mod lit;
3+
mod pol;
4+
mod var;
35

4-
pub mod lit;
5-
pub mod pol;
6-
pub mod var;
6+
pub use lit::Lit;
7+
pub use pol::{Negate, NegateInPlace, Pol};
8+
pub use var::Var;

lit/src/pol.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -156,33 +156,23 @@ impl ops::Not for &'_ Pol {
156156
}
157157
}
158158

159+
/// Subtrait of `ops::Not` and `ops::BitXor<Pol>` for types that support Boolean negation.
160+
///
161+
/// Types that implement `Negate` and `Clone` should also implement `Negate` for references.
159162
pub trait Negate:
160163
Sized
161164
+ ops::Not<Output = <Self as Negate>::Negated>
162165
+ ops::BitXor<Pol, Output = <Self as Negate>::Negated>
163166
{
164167
// Not called Output as that's ambiguous with the supertrait's Output
168+
/// The common output type when invoking the `!` or `^` operator.
165169
type Negated;
166-
167-
#[inline(always)]
168-
fn negate(self) -> <Self as Negate>::Negated
169-
where
170-
Self: Sized,
171-
{
172-
!self
173-
}
174-
175-
#[inline(always)]
176-
fn apply_pol(self, pol: Pol) -> <Self as Negate>::Negated {
177-
self ^ pol
178-
}
179170
}
180171

172+
/// Subtrait of `Negate` and `ops::BitXorAssign<Pol>` for types that support in-place Boolean negation.
181173
pub trait NegateInPlace: Negate<Negated = Self> + ops::BitXorAssign<Pol> {
174+
/// Performs `ops::Not::not` in-place.
182175
fn negate_in_place(&mut self);
183-
fn apply_pol_in_place(&mut self, pol: Pol) {
184-
*self ^= pol;
185-
}
186176
}
187177

188178
impl ops::BitXorAssign<Pol> for u64 {
@@ -196,15 +186,9 @@ impl Negate for u64 {
196186
}
197187

198188
impl NegateInPlace for u64 {
199-
#[inline(always)]
200189
fn negate_in_place(&mut self) {
201190
*self = !*self;
202191
}
203-
204-
#[inline(always)]
205-
fn apply_pol_in_place(&mut self, pol: Pol) {
206-
*self ^= 0 ^ pol;
207-
}
208192
}
209193

210194
impl Negate for &u64 {

0 commit comments

Comments
 (0)