#gmp #numeric #bignum #ffi

sys no-std gmpmee-sys

Rust FFI bindings for GMPMEE

3 releases

0.1.2 Feb 9, 2025
0.1.1 Dec 28, 2024
0.1.0 Dec 28, 2024

#1777 in Math

Download history 196/week @ 2024-12-25 35/week @ 2025-01-01 22/week @ 2025-01-08 22/week @ 2025-01-15 7/week @ 2025-01-22 3/week @ 2025-01-29 136/week @ 2025-02-05 52/week @ 2025-02-12 24/week @ 2025-02-19 23/week @ 2025-02-26

236 downloads per month
Used in 4 crates (via rug-gmpmee)

LGPL-3.0+

225KB
2K SLoC

C 1K SLoC // 0.4% comments Rust 484 SLoC // 0.2% comments Forge Config 265 SLoC // 0.9% comments Python 212 SLoC // 0.2% comments Automake 69 SLoC // 0.3% comments

Contains (obscure autoconf code, 3KB) verificatum-gmpmee-2.1.0-c/configure.ac

Rust low-level bindings for GMPMEE

The gmpmee-sys crate provides Rust FFI bindings to the GMP Modular Exponentiation Extension (GMPMEE), which is a minor extension of GMP. It adds simultaneous modular exponentiation and fixed base modular exponentiation functionality to the set of integer functions (the mpz-functions), as well as special purpose primality testing routines.

The crate is strongly inspired from gmp-mpfr-sys. In particular the file build.rs is copied from this crate, and adapted to the needs of the gmpmee-sys crate. No cache is implemented, since the compilation is quick.

Types

Unlike in the C libraries, the types (e.g. gmpmee_spowm_tab, gmpmee_fpowm_tab) are defined directly as structs, not as single-element arrays.

Using gmpmee-sys

The gmpmee-sys crate is available on crates.io. To use gmpmee-sys in your crate, add it as a dependency inside [Cargo.toml]:

[dependencies]
gmpmee-sys = "0.1"

Building on GNU/Linux

To build on GNU/Linux, simply make sure you have diffutils, gcc, make, autotools, m4 and gmp installed on your system. For example on Debian:

sudo apt update 
sudo apt install diffutils gcc make m4 autotools gmp

Building on macOS

To build on macOS, you need the command-line developer tools. To install them, run the following command in a terminal:

xcode-select --install

Building on Windows

Actually the crate is not working for Windows

Licence

The gmpee-sys crate is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See the full text of the LICENSE for details.

Dependencies

~18MB
~446K SLoC