I was trying to come up with inline assembly for gcc to get both division and modulus using single divl
instruction. Unfortunately, I am not that good at assembly. Could someone please help me on this? Thank you.
Yes -- a divl will produce the quotient in eax and the remainder in edx. Using Intel syntax, for example:
mov eax, 17
mov ebx, 3
xor edx, edx
div ebx
; eax = 5
; edx = 2