From 4670274ec303082e0fb86ff3be1ea4170a17662f Mon Sep 17 00:00:00 2001 From: Leo Uino Date: Fri, 15 Jul 2011 14:20:41 +0900 Subject: qr_mask_apply() works in-place --- lpg/libqr/code-common.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'lpg/libqr/code-common.c') diff --git a/lpg/libqr/code-common.c b/lpg/libqr/code-common.c index 422f2ac..1cb1745 100644 --- a/lpg/libqr/code-common.c +++ b/lpg/libqr/code-common.c @@ -74,18 +74,12 @@ void qr_get_rs_block_sizes(int version, assert(data_words + ec_words == total_words); } -struct qr_bitmap * qr_mask_apply(const struct qr_bitmap * orig, - unsigned int mask) +void qr_mask_apply(struct qr_bitmap * bmp, int mask) { - struct qr_bitmap * bmp; int i, j; - if (mask > 7) - return 0; - - bmp = qr_bitmap_clone(orig); - if (!bmp) - return 0; + assert((mask & 0x7) == mask); + mask &= 0x7; /* Slow version for now; we can optimize later */ @@ -111,7 +105,5 @@ struct qr_bitmap * qr_mask_apply(const struct qr_bitmap * orig, p[off] ^= (t == 0) << bit; } } - - return bmp; } -- cgit v1.2.3-70-g09d2