I recently asked a question about 1024-bit signed multiplication. Now I want to implement integer division using the same number format.
typedef struct int1024
{
uint32_t num[32];
} int1024;
For multiplication I used x86 inline asm using the mulx
, add
, mov
, and adc
instructions without any branching. Is there any integer division algorithm that performs integer division using a number that is segmented up in 32-bit blocks without branching? (as an idea, maybe one that uses the division instruction itself)? (If possible a 128-bit code example would be great if it exists, in order to avoid the sheer amount of instructions for 1024-bit numbers, thanks for your time)