BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gf2xtypes.h
Go to the documentation of this file.
1 /*
2 This file is part of BitPunch
3 Copyright (C) 2014-2015 Frantisek Uhrecky <frantisek.uhrecky[what here]gmail.com>
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef BPUT_GF2XTYPES_H
19 #define BPUT_GF2XTYPES_H
20 
21 #include <stdint.h>
22 
26 typedef uint16_t BPU_T_GF2_16x;
27 
31 typedef uint32_t BPU_T_GF2_32x;
32 
36 typedef struct _BPU_T_GF2_16x_Vector {
38  uint8_t len;
40 
44 typedef struct _BPU_T_GF2_16x_Matrix {
46  uint16_t k;
47  uint16_t n;
49 
53 typedef struct _BPU_T_GF2_16x_Poly{
55  int16_t deg;
56  int16_t max_deg;
58 
63 #define BPU_gf2xPolyNull(d_pointer) memset((void *) ((d_pointer)->coef), 0, sizeof(BPU_T_GF2_16x)*((d_pointer)->max_deg + 1));\
65  (d_pointer)->deg = -1
66 
68 
76 int BPU_gf2xMatMalloc(BPU_T_GF2_16x_Matrix **m, int rows, int cols);
78 
85 int BPU_gf2xVecMalloc(BPU_T_GF2_16x_Vector **vec, int size);
86 
92 
99 
106 int BPU_gf2xPolyMalloc(BPU_T_GF2_16x_Poly **p, int16_t max_deg);
107 
114 int BPU_gf2xPolyResize(BPU_T_GF2_16x_Poly *p, int16_t max_deg);
115 
122 int BPU_gf2xPolyMallocCoef(BPU_T_GF2_16x_Poly *p, int16_t max_deg);
123 
129 
130 #endif // BPUT_GF2XTYPES_H
struct _BPU_T_GF2_16x_Vector BPU_T_GF2_16x_Vector
int BPU_gf2xPolyResize(BPU_T_GF2_16x_Poly *p, int16_t max_deg)
BPU_gf2xPolyResize Resize polynomial, increase max deg.
Definition: gf2xtypes.c:121
void BPU_gf2xMatFree(BPU_T_GF2_16x_Matrix **m)
Free dynamically or statically allocated matrix.
Definition: gf2xtypes.c:86
int BPU_gf2xPolyMallocCoef(BPU_T_GF2_16x_Poly *p, int16_t max_deg)
BPU_gf2xPolyMallocCoef Malloc internal coeficients for polynomial.
Definition: gf2xtypes.c:128
BPU_T_GF2_16x ** elements
all element of matrix
Definition: gf2xtypes.h:45
int BPU_gf2xVecMalloc(BPU_T_GF2_16x_Vector **vec, int size)
BPU_gf2xVecMalloc Malloc vector structure.
Definition: gf2xtypes.c:60
uint16_t BPU_T_GF2_16x
Definition: gf2xtypes.h:26
void BPU_gf2xPolyFree(BPU_T_GF2_16x_Poly **p)
Definition: gf2xtypes.c:102
BPU_T_GF2_16x * elements
Definition: gf2xtypes.h:37
uint16_t n
cols
Definition: gf2xtypes.h:47
uint8_t len
number of elements
Definition: gf2xtypes.h:38
struct _BPU_T_GF2_16x_Matrix BPU_T_GF2_16x_Matrix
int BPU_gf2xMatMalloc(BPU_T_GF2_16x_Matrix **m, int rows, int cols)
Allocate memory for matrix.
Definition: gf2xtypes.c:28
void BPU_gf2xVecFree(BPU_T_GF2_16x_Vector **vec)
BPU_gf2xVecFree Free vector structure.
Definition: gf2xtypes.c:77
uint32_t BPU_T_GF2_32x
Definition: gf2xtypes.h:31
int16_t max_deg
degree
Definition: gf2xtypes.h:56
BPU_T_GF2_16x * coef
Polynomial over GF2m.
Definition: gf2xtypes.h:54
struct _BPU_T_GF2_16x_Poly BPU_T_GF2_16x_Poly
uint16_t k
rows
Definition: gf2xtypes.h:46
int16_t deg
degree
Definition: gf2xtypes.h:55
void BPU_gf2xMatNull(BPU_T_GF2_16x_Matrix *mat)
Definition: gf2xtypes.c:148
int BPU_gf2xPolyMalloc(BPU_T_GF2_16x_Poly **p, int16_t max_deg)
Definition: gf2xtypes.c:111