Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Fixes compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mfukar committed Oct 6, 2016
1 parent a2566a4 commit 0ecc681
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions lfsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @version 1.1
* @date
* Created: Wed Feb 02, 2011 18:47 EET
* Last Update: Wed Sep 18, 2013 13:54 BST
* Last Update: Thu Oct 06, 2016 14:42 CEST
*------------------------------------------------------------------------
* Description: Galois LFSR software implementation
* WARNING:
Expand Down Expand Up @@ -42,10 +42,9 @@
*/
#include "lfsr.h"

void GLFSR_init(lfsr_t *glfsr, lfsr_data_t polynom, lfsr_data_t seed_value)
{
void GLFSR_init(lfsr_t *glfsr, lfsr_data_t polynom, lfsr_data_t seed_value) {
lfsr_data_t seed_mask;
unsigned int shift = 8 * sizeof lfsr_data_t - 1;
unsigned int shift = 8 * sizeof (lfsr_data_t) - 1;

glfsr->polynomial = polynom | 1;
glfsr->data = seed_value;
Expand All @@ -63,8 +62,7 @@ void GLFSR_init(lfsr_t *glfsr, lfsr_data_t polynom, lfsr_data_t seed_value)
return;
}

unsigned char GLFSR_next(lfsr_t *glfsr)
{
unsigned char GLFSR_next(lfsr_t *glfsr) {
unsigned char retval = 0;

glfsr->data <<= 1;
Expand Down
10 changes: 5 additions & 5 deletions prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file prng.c
* @author Michael Foukarakis
* @date Created: Wed Mar 12, 2014 14:03 GMT
* Last Update: Wed Mar 12, 2014 14:05 GMT
* Last Update: Thu Oct 06, 2016 14:43 CEST
* @description PRNG using linear feedback shift registers.
* One shift register is used to provide data, while another register is used
* to "clock" data output; meaning a data bit is output when the clock
Expand Down Expand Up @@ -37,12 +37,12 @@ int main(int argc, char **argv)
exit(-1);
}

sscanf(argv[1], "%lx", &polynom_d);
sscanf(argv[2], "%lx", &init_value_d);
sscanf(argv[1], "%llx", &polynom_d);
sscanf(argv[2], "%llx", &init_value_d);
GLFSR_init(&glfsr_d0, polynom_d, init_value_d);

sscanf(argv[3], "%lx", &polynom_c);
sscanf(argv[4], "%lx", &init_value_c);
sscanf(argv[3], "%llx", &polynom_c);
sscanf(argv[4], "%llx", &init_value_c);
GLFSR_init(&glfsr_c0, polynom_c, init_value_c);

do {
Expand Down

0 comments on commit 0ecc681

Please sign in to comment.