Re: compiler generated output
- From: Spiro Trikaliotis <spamtrap@xxxxxxxxxx>
- Date: Wed, 26 Oct 2005 17:51:44 +0000 (UTC)
Hello Gerd,
Gerd Isenberg <spamtrap@xxxxxxxxxx> schrieb:
> So the code snipped from AMD Optimization Guide is recommended
>
> Remainder of Signed Division by 2n or -(2n)
> ; In: EAX = dividend
> ; Out: EAX = remainder
> cdq ; Sign extend into EDX.
> and edx, (2^n - 1) ; Mask correction (abs(divisor) - 1)
> add eax, edx ; Apply pre-correction.
> and eax, (2^n - 1) ; Mask out remainder (abs(divisor) - 1)
> sub eax, edx ; Apply pre-correction if necessary.
Well, very interesting. I had to think about that code in order to
understand that it really works. ;)
Regards,
Spiro.
--
Spiro R. Trikaliotis http://cbm4win.sf.net/
http://www.trikaliotis.net/ http://www.viceteam.org/
.
- Follow-Ups:
- Re: compiler generated output
- From: Gerd Isenberg
- Re: compiler generated output
- References:
- Re: compiler generated output
- From: Skarmander
- Re: compiler generated output
- From: Spiro Trikaliotis
- Re: compiler generated output
- From: Gerd Isenberg
- Re: compiler generated output
- From: Gerd Isenberg
- Re: compiler generated output
- Prev by Date: Re: improve strlen
- Next by Date: Re: improve strlen
- Previous by thread: Re: compiler generated output
- Next by thread: Re: compiler generated output
- Index(es):
Relevant Pages
|