我正在尝试 32 位二进制乘法器的 C++ 实现。我只知道这样做的一种方法是
1011 (this is 11 in decimal)
x 1110 (this is 14 in decimal)
======
0000 (this is 1011 x 0)
1011 (this is 1011 x 1, shifted one position to the left)
1011 (this is 1011 x 1, shifted two positions to the left)
1011 (this is 1011 x 1, shifted three positions to the left)
=========
10011010 (this is 154 in decimal).
是否有另一种方法可以做到这一点,因为我必须对更长的二进制数进行操作,所以编码起来并不那么麻烦?