# Package COM.INFORMATIMAGO.COMMON-LISP.ARITHMETIC.P127N2

```
This module implements routines to compute modulo-2 polynomials
in P127[N/2]. (Ensemble de polynômes de degré inférieur ou égal à 127
dans l'ensemble quotient N/2 (ensemble des classes d'équivalences
modulo 2 dans ℕ)).

AGPL3

Copyright Pascal J. Bourguignon 1994 - 2012

This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.
```
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
GG:      A polynom of degree 32 modulo N/2 (type (unsigned-byte 32)).
DO:      Adds the polynom GG to POLY.
RETURN:  The modified POLY.
```
 (divide32 poly gg) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
GG:      A polynom of degree 32 modulo N/2 (type (unsigned-byte 32)).
DO:      Divides the polynom POLY by GG.
RETURN:  POLY; the remainder (unsigned-byte 32)..
```
 (even-parity byte) function
```RETURN: The BYTE with the parity bit set to even parity.
```
 (insert-bit7 poly) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
DO:      Inserts into the POLY a 7th bit that is the even parity of the lowest 7 bits.
RETURN:  POLY
```
 (multiply32 poly gg) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
GG:      A polynom of degree 32 modulo N/2 (type (unsigned-byte 32)).
DO:      Multiplies the polynom POLY by GG.
RETURN:  The modified POLY.
```
 (odd-parity byte) function
```RETURN: The BYTE with the parity bit set to odd parity.

```
 poly type
`A polynom of order 127.  We represent them as vectors of four 32-bit words.`
 (poly-from-bytes bytes) function
```BYTES:   A vector of at least 16 octets, in big endian order.
Only the 16 first octets are used.
RETURN:  The poly stored in the bytes.
```
 (poly-prin1-to-string poly) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
RETURN:  A string containing a human readable representation of the polynom POLY.
(it is of the form "x^M + … + x^m").
```
 (poly-to-bytes poly) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
RETURN:  A vector of 16 octets in big endian order encoding the polynom.
```
 (remainder32 poly gg) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
GG:      A polynom of degree 32 modulo N/2 (type (unsigned-byte 32)).
RETURN:  the remainder (unsigned-byte 32) of POLY divided by GG.
NOTE:    Doesn't modify POLY.
```
 (remove-bit7 poly) function
```POLY:    A polynom of degree 127 modulo N/2 (type POLY).
DO:      Modifies POLY, removing the 7th bit.
RETURN:  POLY
```