Intel Vol.2, page 3-179, there is a misspelling and it says
OperNAD, ha. Yes it's childish, yet it is still funny.

Couple of questions, first on regular div, and the other on division using SSE.

I just wrote a long thing up then deleted because pretty much answered my own question about div. Basically I was trying to divide a large 64bit unsigned hex by small numbers like 3 and wasn't sure how to do it without the overflow thing.

I have to do long division on a string of a few thousand hexidecimal digits anyway so I could just do 32bits at a time and save the result from eax somewhere and then load up the next 4 hexdigits into Eax instead of trying to do a full quadword at a time since the remainder is put in edx as I relized in mid post.
If something about this seems bad flame me and tell me a better way.

Is there a way to make div put the quotient somewhere other than eax so that I don't have to move it after each div?

Is there an operation I can do on integers with the SSE or MMX that will give me a quotient and remainder, or maybe at least either/or??

I found instructions for multiplying, and also for dividing floating points but I can't lose anything to rounding. I don't know much about mmx but it's my vague understanding that you can do the same operation on a bunch of data at one time?

Thanks in advance.
Posted on 2002-02-18 00:06:47 by WebSnozz
Ooo, Integer Overlow? You can't use div to divide by a very small number. I suggest you do this using FPU...

Operand1 DQ ?
Operand2 DQ ?
Result DQ ?

mov eax, 100
mov DWORD ptr [Operand1], eax
mov eax, 3
mov DWORD ptr [Operand2], eax

fld Operand1
fdiv Operand2 ; Operand1 / Operand2
fstp Result

Result holds the answer to 100/3, You can then use FloatToStr or FloatToStr2 from the masm32 library. There's an FPU tutorial in the Code and Algorithms section by Eoin or The Svin.

You can always use sub to do your division. Check the Code and Algorithms section and look for the thread: How does DIV works or How Div Works Part2

Happy Coding!!!
Posted on 2002-02-18 00:36:33 by stryker
bitRAKEs propably the one to talk to here as I believe he was/is working on a bignum library.

However regarding sse, I don't think that'll work as that deals with real4 floats. As for mmx, it doesn't have div so probably won't be any help either. :(
Posted on 2002-02-18 03:45:35 by Eóin