Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
L
LEPL1503-2022-skeleton
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Dimitri Demaret
LEPL1503-2022-skeleton
Validations
c9b1059f
Valider
c9b1059f
rédigé
3 years ago
par
Louis Navarre
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Add system function definitions
parent
e9d1d204
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
headers/system.h
+53
-0
53 ajouts, 0 suppression
headers/system.h
main.c
+13
-13
13 ajouts, 13 suppressions
main.c
avec
66 ajouts
et
13 suppressions
headers/system.h
+
53
−
0
Voir le fichier @
c9b1059f
#ifndef SYSTEM_H
#ifndef SYSTEM_H
#define SYSTEM_H
#define SYSTEM_H
#include
<stdint.h>
typedef
struct
typedef
struct
{
{
// TODO
// TODO
}
system_t
;
}
system_t
;
/**
*
* Add two vectors in a Galois Field 256
* @param symbol_1: the first symbol to add
* @param symbol_2: the second symbol to add
* @param symbol_size: size of the two symbols (of the same size!)
* @return: a new vector of `symbol_size` byte containing the result of symbol_1 + symbol_2 in GF(256)
*/
uint8_t
*
gf256_add_two_vectors
(
uint8_t
*
symbol_1
,
uint8_t
*
symbol_2
,
uint32_t
symbol_size
);
/**
*
* Add two vectors in a Galois Field 256 where the second vector is scaled
* @param symbol_1: the first symbol to add
* @param symbol_2: the second symbol to add (the scaled one)
* @param coef: the coefficient of the scaling
* @param symbol_size: size of the two symbols (of the same size!)
* @return: a new vector of `symbol_size` byte containing the result of symbol_1 + symbol_2 * coef in GF(256)
*/
uint8_t
*
gf256_add_two_vectors_scaled
(
uint8_t
*
symbol_1
,
uint8_t
*
symbol_2
,
uint8_t
coef
,
uint32_t
symbol_size
);
/**
*
* Divide a vector in a Galois Field 25§ by a coefficient
* @param symbol: the symbol to add
* @param coef: the dividing coefficient
* @param symbol_size: size of the two symbols (of the same size!)
* @return: a new vector of `symbol_size` byte containing the result of symbol_1 / coef
*/
uint8_t
*
gf256_divide_vector_scaled
(
uint8_t
*
symbol
,
uint8_t
coef
,
uint32_t
symbol_size
);
/**
*
* Resolve the linear system Ax=b in a Galois Field 256. The result is stored in the independent terms after the resolution
* @param A: matrix of coefficients
* @param b: independent terms
* @param symbol_size: size of the independent terms
* @param system_size: the size of the system (i.e., number of rows/columns)
*/
void
gf256_gaussian_elimination
(
uint8_t
**
A
,
uint8_t
**
b
,
uint32_t
symbol_size
,
uint32_t
system_size
);
/**
*
* Generate all coefficients for a block
* @param seed: the seed to generate the coefficients
* @param nss: number of source symbols in a block
* @param nrs: number of repair symbols in a block
* @return: a nss * nrs array of coefficients
*/
uint8_t
**
gen_coef
(
uint32_t
seed
,
uint32_t
nss
,
uint32_t
nrs
);
#endif
/* SYSTEM_H */
#endif
/* SYSTEM_H */
\ No newline at end of file
Ce diff est replié.
Cliquez pour l'agrandir.
main.c
+
13
−
13
Voir le fichier @
c9b1059f
...
@@ -142,19 +142,19 @@ int main(int argc, char *argv[])
...
@@ -142,19 +142,19 @@ int main(int argc, char *argv[])
// You may modify or delete the following lines. This is just an example of how to use tinymt32
// You may modify or delete the following lines. This is just an example of how to use tinymt32
uint32_t
seed
=
42
;
// Replace with the seed from the instance file!
uint32_t
seed
=
42
;
// Replace with the seed from the instance file!
tinymt32_t
prng
;
tinymt32_t
prng
;
memset
(
&
prng
,
0
,
sizeof
(
tinymt32_t
));
memset
(
&
prng
,
0
,
sizeof
(
tinymt32_t
));
// Do not modify these values!
// Do not modify these values!
prng
.
mat1
=
0x8f7011ee
;
prng
.
mat1
=
0x8f7011ee
;
prng
.
mat2
=
0xfc78ff1f
;
prng
.
mat2
=
0xfc78ff1f
;
prng
.
tmat
=
0x3793fdff
;
prng
.
tmat
=
0x3793fdff
;
tinymt32_init
(
&
prng
,
seed
);
tinymt32_init
(
&
prng
,
seed
);
// You can generate coefficients by calling this function
// You can generate coefficients by calling this function
// Do not forget that we use byte values, so we have to
// Do not forget that we use byte values, so we have to
// cast the uint32_t returned value to only keep the last 8 bits.
// cast the uint32_t returned value to only keep the last 8 bits.
uint8_t
coef
=
(
uint8_t
)
tinymt32_generate_uint32
(
&
prng
);
uint8_t
coef
=
(
uint8_t
)
tinymt32_generate_uint32
(
&
prng
);
if
(
args
.
verbose
)
if
(
args
.
verbose
)
{
{
printf
(
"Coefficient: %u
\n
"
,
coef
);
printf
(
"Coefficient: %u
\n
"
,
coef
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter