Eigene XOR Funktion

Liebe Leser,

ein kleines Code-Snippet für alle, die die XOR-Funktion verstehen wollen 😉

#cs
Coding by www.agrafix.net

---------------------
The functions
---------------------
#ce
; Nand Function
Func nand($a, $b)
	Return BitNOT(BitAnd($a, $b))
EndFunc

; XOR Function
Func xor($a, $b)
	Return  nand(nand($a, nand($a, $b)), nand($b, nand($a,$b)))
EndFunc

#cs
---------------------
Proof of Concept: my xor function returns the same stuff as the Built-in XOR function
---------------------
#ce
If xor(0xAB, 0xBC) == BitXor(0xAB, 0xBC) Then ; horray, it works!
	ConsoleWrite("Congratz Bro, you coded a XOR function :D" & @CRLF)
Else ; this will never happen
	ConsoleWrite("Sorry, but you suck!" & @CRLF)
EndIf

Viel Vergnügen damit,
Agrafix