Is there a way to perform addition(or arithmetic operations) by using ONLY bitwise operators?
Is there a way to perform addition(or arithmetic operations) by using ONLY bitwise operators?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Addition of bits a,b and c
One has to perform this for all bits in the word – first for bit 0 using carry_in = c = 0, and iterating to carry_in(next_bit) = carry_out(previous_result).
Subtraction happens with bit inverting b from (a-b) and setting the initial carry to 1.
However, if one has to add e.g 32 numbers in parallel, one can fit ‘a’ with 32 lsbs of all those numbers and perform the binary operations in parallel. This is a technique called bit slicing.
For multiplication CSA (carry save adder is definitely the best software approach — it has the smallest “area”)
As an exercise, here’s an algorithm that calculates a+b(+c) in parallel: