Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Integer, Z, and Rational in FFI #1432

Merged
merged 14 commits into from
Sep 23, 2022
Merged

Support Integer, Z, and Rational in FFI #1432

merged 14 commits into from
Sep 23, 2022

Conversation

qsctr
Copy link
Contributor

@qsctr qsctr commented Sep 10, 2022

Add support for Integer, Z, and Rational in the FFI, mapping to GMP mpz_t and mpq_t.

For Integer and Z arguments are mapped to const mpz_t input parameter and return types are mapped to mpz_t output parameter. For Rational it is const mpq_t and mpq_t respectively. Sequences of these types are supported too, mapping to pointers to those types.

Note: Right now Z always uses mpz_t even if the modulus is small enough to fit in an Int. Also, the type argument of Z is allowed to be polymorphic. Not sure if either of those are the right choices.

Remaining work:

  • Add tests
  • Update RefMan
  • When generate headers code is merged, update it to support the new types

Closes #1395.

@qsctr qsctr added language Changes or extensions to the language FFI Foreign function interface labels Sep 10, 2022
@qsctr qsctr changed the title Support Integer in FFI Support Integer, Z, and Rational in FFI Sep 10, 2022
@yav yav merged commit 146934b into master Sep 23, 2022
@RyanGlScott RyanGlScott deleted the ffi-integer branch March 22, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FFI Foreign function interface language Changes or extensions to the language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arbitrary precision types in FFI
2 participants