-
Notifications
You must be signed in to change notification settings - Fork 13.4k
add evocative examples for BitOr
and BitXor
#35926
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Let's slow down a bit here. There was an interesting debate on the nature of bitwise operations here: #35927. I plan to update |
I've taken the improvements in #35993 and applied them to this PR. I figured that a simple |
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
b70b459
to
8ca9fa1
Compare
Thanks! @bors: r+ rollup |
📌 Commit 8ca9fa1 has been approved by |
… 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
… 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
… 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
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