diff options
author | Leo Howell <leo@lwh.jp> | 2009-09-26 11:45:30 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-09-26 13:24:48 +0900 |
commit | 64a96442629b720b2e2b1cc3997ee3dbc6a71b90 (patch) | |
tree | 1f7be34bd5da6f21ac5e91e2539b9dfcc6b400b0 /lpg/libqr/rs-encode.c | |
parent | 825c45bed29693e9420abecdeb4ebcd03aa3accd (diff) | |
download | pdf-simple-sign-64a96442629b720b2e2b1cc3997ee3dbc6a71b90.tar.gz pdf-simple-sign-64a96442629b720b2e2b1cc3997ee3dbc6a71b90.tar.xz pdf-simple-sign-64a96442629b720b2e2b1cc3997ee3dbc6a71b90.zip |
get ready for multiple RS blocks
Diffstat (limited to 'lpg/libqr/rs-encode.c')
-rw-r--r-- | lpg/libqr/rs-encode.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lpg/libqr/rs-encode.c b/lpg/libqr/rs-encode.c index ea54d77..1e6c6bf 100644 --- a/lpg/libqr/rs-encode.c +++ b/lpg/libqr/rs-encode.c @@ -46,17 +46,17 @@ static unsigned int * make_generator(int k) return g; } -struct bitstream * rs_generate_words(int n, struct bitstream * data) +struct bitstream * rs_generate_words(struct bitstream * data, + size_t data_words, + size_t rs_words) { struct bitstream * ec = 0; unsigned int * b = 0; unsigned int * g; - size_t dlen; + size_t n = rs_words; int i, r; - dlen = bitstream_size(data); - assert(dlen % 8 == 0); - dlen /= 8; + assert(bitstream_remaining(data) >= data_words * 8); ec = bitstream_create(); if (!ec) @@ -75,7 +75,7 @@ struct bitstream * rs_generate_words(int n, struct bitstream * data) /* First, prepare the registers (b) with data bits */ bitstream_seek(data, 0); - for (i = 0; i < dlen; ++i) { + for (i = 0; i < data_words; ++i) { unsigned int x = b[n-1] ^ bitstream_read(data, 8); for (r = n-1; r > 0; --r) b[r] = b[r-1] ^ gf_mult(g[r], x); |