I know they can for addition and subtraction, but I'm not quite sure if they can for multiplication.

closed as unclear what you're asking by gnat, Thomas Owens Sep 28 '17 at 9:29

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


As far as hardware goes, unsigned multiplication and signed multiplication are exactly the same (ignoring flags). When you multiply 11111111 and 11111111, the result is 00000001, regardless of whether the inputs are considered to mean -1 or 255.

That said, I don't know if the two operations would have a different effect on the carry and overflow flags, and how the difference is dealt with if so.

  • 1
    Re. flags, on x86, I believe both mul (unsigned multiply two n-bit integers, giving 2n-bit result) and imul (signed or unsigned multiply two n-bit integers, giving n-bit result) have the same effect on the carry and overflow flags: 0 if the upper word of the un-truncated result is 0, 1 otherwise. – Jon Purdy Sep 27 '17 at 23:30

Can unsigned and signed (two's complement) multiplication be performed on the same hardware?

Assume an N bit width.

The trick is that the hardware can do a signed N+1 * N+1 wide multiplication, thus re-using most of the hardware when doing unsigned*unsigned, signed*signed or mixed signed multiplication.

2's complement N+1 operands can handle the entire range of intN_t and uintN_t. The final 2's complement 2*N + 1 product can simply save the desired bits into a 2*N destination.

Not the answer you're looking for? Browse other questions tagged or ask your own question.