Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/correct.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
#include <stdint.h>

#ifndef _MSC_VER
#if defined(unix) || defined(__unix__) || defined(__unix)
#include <unistd.h>
#else
#define ssize_t int
#endif
#else
#include <stddef.h>
typedef ptrdiff_t ssize_t;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/convolutional/history_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint8_t *history_buffer_get_slice(history_buffer *buf) { return buf->history[buf

shift_register_t history_buffer_search(history_buffer *buf, const distance_t *distances,
unsigned int search_every) {
shift_register_t bestpath;
shift_register_t bestpath = 0;
distance_t leasterror = USHRT_MAX;
// search for a state with the least error
for (shift_register_t state = 0; state < buf->num_states; state += search_every) {
Expand Down
2 changes: 1 addition & 1 deletion src/convolutional/lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pair_lookup_t pair_lookup_create(unsigned int rate,
pair_lookup_t pairs;

pairs.keys = malloc(sizeof(unsigned int) * (1 << (order - 1)));
pairs.outputs = calloc((1 << (rate * 2)), sizeof(unsigned int));
pairs.outputs = calloc((1 << (order - 1)) + 1, sizeof(unsigned int));
unsigned int *inv_outputs = calloc((1 << (rate * 2)), sizeof(unsigned int));
unsigned int output_counter = 1;
// for every (even-numbered) shift register state, find the concatenated output of the state
Expand Down