0

Let's assume we are given N1 and N2: q-bit length 2 binary numbers. For simplicity, both are unsigned integers. Can we express multiplication or addition of N1 and N2 in terms of the number of bit-wise operations like AND, OR, XOR, SHIFT needed to perform this operation??? Reasonable estimation would also be fine.

Every information, thoughts, links are highly appreciated.

Thanks!

  • 1
    Here's addition http://stackoverflow.com/questions/10701970/addition-as-binary-operations – amdn Apr 29 '14 at 02:08
  • This is essentially how the hardware implements arithmetic, since the ALU is just a bunch of binary gates. So yes, you can express multiplication in terms of those operations. – Barmar Apr 29 '14 at 02:09
  • Why would you need to do this in normal programming, though? What problem are you trying to solve (other than a puzzle or computer architecture homework assignment)? – Barmar Apr 29 '14 at 02:10
  • Once you have an adder, and given that you have a shifter, you can build a multiplier... think about how you do it in decimal, then do it with binary. Binary has the nice property that as you multiply N1 by each bit in N2, the product is either N1 (shifted) or zero. – amdn Apr 29 '14 at 02:14
  • Lot's of links on youtube for binary multiplication https://www.youtube.com/results?search_query=binary+multiplication – amdn Apr 29 '14 at 02:18

0 Answers0