XOR ?

BlitzMax Forums/BlitzMax Programming/XOR ?

Hi

Do you know if bmax have XOR operator ?

Cheers

No it hasn't *see Language - Expression*

Hi :)

I have find

use : ~

example :

Print 100 ~ 10

~ is not ... not xor

a xor b = (a & ~b) | (~a & b)

Depends how you use it (XOR is a bitwise NOT/compliment)

b = 10
Print Bin$(b)

b :~ 2
Print Bin$(b)

b :~ 2
Print Bin$(b)

Print Bin$(~b)


hmm yeah you are right.
Sorry for wrong posting above.

Somehow missed the 2nd appearance of it in the help ...

So :) what is XOR :) ?

&~ ?

:~ ?

Can you clarify ?

XOR is '~', eg:

Print $face ~ $babe

Bitwise invert is also '~', eg:

Print ~0

This is similar to the dual use of the minus sign.

Ok thanks mark :) for support ! :)

interesting...

mark, can you add new keywords for this??? i don't like such symbols - this is unreadable

~ -> XOR
| -> BOR (bitwise OR)
& -> BAND (bitwise AND)

please please please...

i agree !

I agree also.
I like how we use Mod instead of %%%%@$#%^%^
An how we can do x:Int,z:String, instead of x%,z$!#%@$%#

And it sure would save having to search the forum to find out why XOR doesn't work any more.

mark, can you add new keywords for this???
Shouldn't it be BXOR tho? For consistence, XOR should be a conditional expression, ala. And Or and Not.

Flameduck:

x=~x
or
x=XOR x (if it available in some days..years)
is the same like
x=-x

but

x=y~z
is harder to read than
x=y XOR z

theoreticaly here should exist XOR and BXOR...

I don't understand why mark sibly do not add BAND, BOR and XOR-words... otherwise blitzmax looks so "unperfect"

r=(argb SHR 16) & 255

looks not so good

r=(argb SHR 16) BAND 255

is much better to read and understand

i think this was a mistake to replace AND to & and add a logic AND instead of this. The most time i forget this and i write each time AND..

more infos

http://en.wikipedia.org/wiki/Xor
http://en.wikipedia.org/wiki/Logical_disjunction
http://en.wikipedia.org/wiki/Logical_conjunction