Divide and Get Remainder at the same time?

后端 未结 9 1129
不知归路
不知归路 2020-12-15 02:37

Apparently, x86 (and probably a lot of other instruction sets) put both the quotient and the remainder of a divide operation in separate registers.

Now, we can proba

9条回答
  •  失恋的感觉
    2020-12-15 03:20

    C has div and ldiv. Whether these generate separate instructions for the quotient and remainder will depend on your particular standard library implementation and compiler and optimization settings. Starting with C99, you also have lldiv for larger numbers.

提交回复
热议问题