Split Multiplication of integers

前端 未结 4 1773
挽巷
挽巷 2020-12-20 07:52

I need an algorithm that uses two 32-bit integers as parameters, and returns the multiplication of these parameters split into two other 32-bit integers: 32-highest-bits par

4条回答
  •  一个人的身影
    2020-12-20 08:43

    As I commented, you can treat each number as a binary string of length 32.

    Just multiply these numbers using school arithmetic. You will get a 64 character long string.

    Then just partition it.

    If you want fast multiplication, then you can look into Karatsuba multiplication algorithm.

提交回复
热议问题