/*******************************************************************
Simulator for Bitwise Quantum Addition
Press "Run" button to compile and execute it.
van=facebook.com/LearningCalculus or facebook.com/lvanwarren
********************************************************************/
#include <stdio.h>
#include <stdlib.h>
typedef unsigned int qInt;
qInt qAND (qInt a, qInt b) { return(a & b); }
qInt qOR (qInt a, qInt b) { return(a ^ b); }
qInt qLEFT (qInt a) { return(a << 1); }
qInt qADD (qInt a, qInt b) { return(b == 0) ? a :
qADD (qOR(a, b), qLEFT(qAND(a, b))); }
int
main (int argc, char **argv)
{
qInt a = atoi (argv[1]);
qInt b = atoi (argv[2]);
printf ("Bitwise Add of %d and %d is: %d\n", a, b, qADD (a, b));
return 0;
}