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 evocative examples for BitOr and BitXor #35926

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

matthew-piziak
Copy link
Contributor

These are exactly equivalent to PR #35809, with one caveat: I do not believe there is a non-bitwise binary XOR operator in Rust, so here it's expressed as (a || b) && !(a && b).

Alternative decompositions are (a && !b) || (!a && b) and (a || b) && (!a || !b). Let me know if you think one of those would be clearer.

r? @GuillaumeGomez

@matthew-piziak
Copy link
Contributor Author

matthew-piziak commented Aug 23, 2016

Let's slow down a bit here. There was an interesting debate on the nature of bitwise operations here: #35927. I plan to update BitAnd first. Once that's in good shape I'll revisit this PR.

@matthew-piziak
Copy link
Contributor Author

matthew-piziak commented Aug 29, 2016

I've taken the improvements in #35993 and applied them to this PR. I figured that a simple assert_eq! was cleaner than enforcing a particular length in the struct, but let me know what you think.

These are exactly equivalent to PR rust-lang#35809, with one caveat: I do not believe there is a non-bitwise binary "xor" operator in Rust, so here it's expressed as (a || b) && !(a && b).

r? @GuillaumeGomez

improved documentation a la PR rust-lang#35993
@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 30, 2016

📌 Commit 8ca9fa1 has been approved by GuillaumeGomez

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 30, 2016
… r=GuillaumeGomez

add evocative examples for `BitOr` and `BitXor`

These are exactly equivalent to PR rust-lang#35809, with one caveat: I do not believe there is a non-bitwise binary XOR operator in Rust, so here it's expressed as `(a || b) && !(a && b)`.

Alternative decompositions are `(a && !b) || (!a && b)` and `(a || b) && (!a || !b)`.  Let me know if you think one of those would be clearer.

r? @GuillaumeGomez
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 31, 2016
… r=GuillaumeGomez

add evocative examples for `BitOr` and `BitXor`

These are exactly equivalent to PR rust-lang#35809, with one caveat: I do not believe there is a non-bitwise binary XOR operator in Rust, so here it's expressed as `(a || b) && !(a && b)`.

Alternative decompositions are `(a && !b) || (!a && b)` and `(a || b) && (!a || !b)`.  Let me know if you think one of those would be clearer.

r? @GuillaumeGomez
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 31, 2016
… r=GuillaumeGomez

add evocative examples for `BitOr` and `BitXor`

These are exactly equivalent to PR rust-lang#35809, with one caveat: I do not believe there is a non-bitwise binary XOR operator in Rust, so here it's expressed as `(a || b) && !(a && b)`.

Alternative decompositions are `(a && !b) || (!a && b)` and `(a || b) && (!a || !b)`.  Let me know if you think one of those would be clearer.

r? @GuillaumeGomez
bors added a commit that referenced this pull request Aug 31, 2016
@bors bors merged commit 8ca9fa1 into rust-lang:master Aug 31, 2016
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.

3 participants