How do we add multiple binary bits with carry using boolean operators XOR and AND.

382 Views Asked by At

My question is similar to How do I add multiple binary numbers without using a partial sum?.

For example, if we add two bits, a and b, then sum bit = a XOR b and carry bit = a AND b.

Is there a way to extend this logic to multiple bits (a,b,c,d,...)?

like sum bit = a XOR b XOR c XOR d XOR...

is the next carry bit = (a AND b) XOR (b AND c) XOR ...? and the final carry bit being a AND b AND c AND...

I am not sure how to calculate the carry bits in this case?