# Details

# Diff Detail

- Repository
- rGHC Glasgow Haskell Compiler
- Branch
- t-15350
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status

libraries/integer-gmp/cbits/wrappers.c | ||
---|---|---|

296 | I notice here and in other functions in this file, we take the limbs and corresponding sizes instead of simply passing a mpz_t. This seems like unnecessary deconstructing and reconstructing of mpz_t. It also forces the Haskell code to decide on a limb size even though that is already handled by the gmp library. Is there a reason for this or can we refactor (accept/return mpz_t instead of mp_limb_t[] and mp_size_t)? |

libraries/integer-gmp/cbits/wrappers.c | ||
---|---|---|

296 | Well, this was an intentional design choice driven by the representation chosen for |

Could you also add a test for `gcdExtInteger (2^65 + 1) 2`, and maybe one with negative operands?

Correct limb length assertion for gcdExtInteger (fixes Trac #15350)

Reviewers: hvr, bgamari

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D5042

I've checked this and it makes sense.

While we are at it, the description of `integer_gmp_gcdext` states that this function "set s and t to coefficients satisfying x*s + y*t = g", but it only sets s (t is not returned in any way). This shouldn't block merging though.