#modular-arithmetic #arithmetic #modular #mod

no-std generic_modular

Modular arithmetic library in Rust with generic number types

1 unstable release

0.1.0 Jul 24, 2019

#21 in #modular-arithmetic

Apache-2.0

11KB
109 lines

generic_modular

Build Status

Modular arithmetic library in Rust with generic number types. Supports no-std.


lib.rs:

Provides a wrapper for integer types with modular arithmetic behaviour.

Since modular arithmetic is commonly used with a specific prime modulus, this crate removes the cost of storing the modulus by hardcoding it in the definition and generating definitions with a macro, enhancing performance.

This also automatically moves modulus equality checking (because values of different modulo cannot be added directly) from runtime to compile time, enhancing stability.

Dependencies

~46KB