Shorthand operator for AND, NOT

A

Archos

Does exist a shorthand assignment operator to assign AND and NOT at
the same time? like &^=
 
M

Michael Haufe (TNO)

Does exist a shorthand assignment operator to assign AND and NOT at
the same time? like &^=

No. But with use of boolean algebra, there may be a simpler
representation anyway for you. !(a && b) == !a || !b
 
A

Archos

No. But with use of boolean algebra, there may be a simpler
representation anyway for you. !(a && b) == !a || !b

Then ,just for archiving, the assignment "&^=" would be:
a = a & b ^ a
 
M

Michael Haufe (TNO)

Then ,just for archiving, the assignment "&^=" would be:
a = a & b ^ a

You do realize that "^" is the XOR operator and not the NOT operator
right?

a = a & b ^ a

is equivalent to:
a = a & ~b

which is equivalent to:
a &= ~b

I still can't see a significant use case for "&^="
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top