| ▲ | cmovq an hour ago | |
Last time I checked LLVM had surprisingly bad codegen for this using int128. On x86 you only need two instructions:
The intermediate 128bit number is in rdx:rax. | ||
| ▲ | bonzini an hour ago | parent [-] | |
That only works if you are sure to have a 64-bit result. If you can have divisor < multiplier and need to detect overflow, it's more complicated. | ||