Four bit adder: Difference between revisions

m
adjusted comment on the reason of using XOR macro and NOT macro, done in that way
m (C: add comment about xor)
m (adjusted comment on the reason of using XOR macro and NOT macro, done in that way)
Line 28:
#define V(X) (*(X))
 
/* a NOT that does not soil the rest of the host of the single bit */
#define NOT(X) (~(X)&0x011)
 
/* a shortcut to "implement" a XOR using only NOT, AND and OR gates, as
task requirements constrain */
#define XOR(X,Y) ((NOT(X)&(Y)) | ((X)&NOT(Y)))
/* XOR would be (X^Y) if that were not forbidden by this task */
 
void halfadder(IN a, IN b, OUT s, OUT c)