Module fp31

Module fp31 

Source
Expand description

An implementation of a 31-bit Mersenne prime (no 2^k roots of unity for k>1) field with modulus 2^31 - 1. Mersenne primes have a fast reductions to to their binary representation.

This field and its implementation has a couple of attractive properties:

  • Addition never overflows a 32-bit int.
  • Efficient for GPUs which optimize throughput for 32-bit and 16-bit arithmetic.
  • Field arithmetic in this field can be implemented using a few 32-bit addition, subtractions, and shifts.

Structsยง

Fp