Commit [f17e3d]  Maximize  Restore  History

More efficient integer division by multiplication

* Exploit restricted range for inputs (e.g. fixnums).

* When the divisor is even, simplify with a mask instead of a shift.

* Clean up the code a bit: we don't want modular arithmetic, it's
actually all guaranteed not to wrap around.

* Change the test so that larger divisors are a bit more likely to
get tested too.

* Lots more things can be done, including generalizing the transform
to pretty much arbitrary rational divisor, or avoiding the costly
general code sequence in nearly all cases. Unfortunately, it's a
lot of (somewhat original, at that) code, and can be fairly slow;
if it matters to someone, I can try and find a compromise (contrib?).

Paul Khuong Paul Khuong 2011-08-14

changed src/compiler/srctran.lisp
changed tests/arith.pure.lisp
src/compiler/srctran.lisp Diff Switch to side-by-side view
tests/arith.pure.lisp Diff Switch to side-by-side view

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks