integer-gmp: Make minusInteger more efficient
ClosedPublic

Authored by alan on May 29 2016, 3:21 AM.

Details

Summary

Give minusInteger its own implementation.
Previously minusInteger used plusInteger and negateInteger, which meant it always allocated. Now it works more like plusInteger.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
alan retitled this revision from to integer-gmp: Make minusInteger more efficient.May 29 2016, 3:21 AM
alan updated this object.
alan edited the test plan for this revision. (Show Details)
alan updated the Trac tickets for this revision.
alan updated this object.May 29 2016, 3:23 AM
alan updated this object.
alan updated this object.
alan updated this object.
bgamari accepted this revision.May 29 2016, 5:00 AM

This looks great! Thanks @alan.

Just a few minor points,

  • the name of the testcase is rather general given it is really just testing addition and subtraction
  • the alignment isn't quite right as noted inline

That being said, these are pretty minor points

libraries/integer-gmp/src/GHC/Integer/Type.hs
423–458

Alignment isn't quite right.

This revision is now accepted and ready to land.May 29 2016, 5:00 AM
hvr awarded a token.May 29 2016, 5:21 AM
hvr accepted this revision.May 29 2016, 5:53 AM

This looks all good to me, thanks!

I've commented one minor request inline, and another minor request would be to add a short entry to libraries/integer-gmp/changelog.md! :-)

testsuite/tests/lib/integer/integerMath.hs
17 ↗(On Diff #7766)

Because I'm paranoid, I'd also add a few values slightly outside the Int range, and also around +/- maxBound :: Word

alan updated this revision to Diff 7774.May 29 2016, 12:22 PM
alan marked 2 inline comments as done.
alan updated this object.

Add additional test cases and fix formatting in Types.hs.

alan updated this revision to Diff 7775.May 29 2016, 12:27 PM

Update changelog.md

This revision was automatically updated to reflect the committed changes.