aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/rs-encode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lpg/libqr/rs-encode.c')
-rw-r--r--lpg/libqr/rs-encode.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lpg/libqr/rs-encode.c b/lpg/libqr/rs-encode.c
index 1e6c6bf..42b404f 100644
--- a/lpg/libqr/rs-encode.c
+++ b/lpg/libqr/rs-encode.c
@@ -1,6 +1,6 @@
#include <assert.h>
#include <stdlib.h>
-#include "bitstream.h"
+#include "qr-bitstream.h"
#include "rs.h"
static unsigned int gf_mult(unsigned int a, unsigned int b)
@@ -46,23 +46,23 @@ static unsigned int * make_generator(int k)
return g;
}
-struct bitstream * rs_generate_words(struct bitstream * data,
+struct qr_bitstream * rs_generate_words(struct qr_bitstream * data,
size_t data_words,
size_t rs_words)
{
- struct bitstream * ec = 0;
+ struct qr_bitstream * ec = 0;
unsigned int * b = 0;
unsigned int * g;
size_t n = rs_words;
int i, r;
- assert(bitstream_remaining(data) >= data_words * 8);
+ assert(qr_bitstream_remaining(data) >= data_words * 8);
- ec = bitstream_create();
+ ec = qr_bitstream_create();
if (!ec)
return 0;
- if (bitstream_resize(ec, n * 8) != 0)
+ if (qr_bitstream_resize(ec, n * 8) != 0)
goto fail;
b = calloc(n, sizeof(*b));
@@ -74,9 +74,9 @@ struct bitstream * rs_generate_words(struct bitstream * data,
goto fail;
/* First, prepare the registers (b) with data bits */
- bitstream_seek(data, 0);
+ qr_bitstream_seek(data, 0);
for (i = 0; i < data_words; ++i) {
- unsigned int x = b[n-1] ^ bitstream_read(data, 8);
+ unsigned int x = b[n-1] ^ qr_bitstream_read(data, 8);
for (r = n-1; r > 0; --r)
b[r] = b[r-1] ^ gf_mult(g[r], x);
b[0] = gf_mult(g[0], x);
@@ -84,14 +84,14 @@ struct bitstream * rs_generate_words(struct bitstream * data,
/* Read off the registers */
for (r = 0; r < n; ++r)
- bitstream_write(ec, b[(n-1)-r], 8);
+ qr_bitstream_write(ec, b[(n-1)-r], 8);
free(g);
free(b);
return ec;
fail:
free(b);
- bitstream_destroy(ec);
+ qr_bitstream_destroy(ec);
return 0;
}