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?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.