Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add operators &, |, ! for Tracer<Bit> #88

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

voltrevo
Copy link
Contributor

Enables you to write eg:

let a = builder.add_input::<bool>();
let b = builder.add_input::<bool>();
let a_or_b = a | b; // Same as `!(!a & !b)`

I wanted these ops when I made a circuit for Rock Paper Scissors Lizard Spock.

Comment on lines +54 to +59
impl<'a> Tracer<'a, Bit> {
/// Returns the single node associated with the bit.
pub fn node(&self) -> Node<Feed> {
self.to_inner().nodes()[0]
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that .to_inner().nodes()[0] could be replaced with .node(), otherwise repeated many times now.


drop(state);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RefMut only lives to the end of the method and the state isn't used before then, so there's no need to explicitly drop it.

Copy link
Collaborator

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@sinui0
Copy link
Collaborator

sinui0 commented Nov 27, 2023

@voltrevo looks like you just need to run fmt

@voltrevo
Copy link
Contributor Author

@voltrevo looks like you just need to run fmt

Done :)

@sinui0 sinui0 merged commit 33ac765 into privacy-scaling-explorations:dev Nov 27, 2023
3 checks passed
@voltrevo voltrevo deleted the more-bit-operators branch November 28, 2023 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants