Common Lisp 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 ℕ)). License: AGPL3 Copyright Pascal J. Bourguignon 1994 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by 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. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Public

ADD32 (POLY GG)

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)

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)

RETURN: The BYTE with the parity bit set to even parity.

INSERT-BIT7 (POLY)

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)

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)

RETURN: The BYTE with the parity bit set to odd parity.

POLY-FROM-BYTES (BYTES)

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)

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)

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)

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)

POLY: A polynom of degree 127 modulo N/2 (type POLY). DO: Modifies POLY, removing the 7th bit. RETURN: POLY

Private

Undocumented

%DIVISION (POLY GG)

VARIABLE

Private

*EVEN-PARITY*

A vector with all legal even-parity bytes, in 7-bit order.

*ODD-PARITY*

A vector with all legal odd-parity bytes, in 7-bit order.