Optimize quirc_flip()
This commit is contained in:
parent
5beb59e3b4
commit
4bc17cf8c6
2 changed files with 13 additions and 14 deletions
13
lib/decode.c
13
lib/decode.c
|
@ -919,13 +919,12 @@ quirc_decode_error_t quirc_decode(const struct quirc_code *code,
|
|||
|
||||
void quirc_flip(struct quirc_code *code)
|
||||
{
|
||||
struct quirc_code flipped;
|
||||
memset(&flipped, 0, sizeof(flipped));
|
||||
int offset = 0;
|
||||
for (int y = 0, sx = 0; y < code->size; y++, sx++) {
|
||||
for (int x = 0, sy = 0; x < code->size; x++, sy++) {
|
||||
if (grid_bit(code, sx, sy)) {
|
||||
flipped.cell_bitmap[offset >> 3] |= (1 << (offset & 7));
|
||||
struct quirc_code flipped = {0};
|
||||
unsigned int offset = 0;
|
||||
for (int y = 0; y < code->size; y++) {
|
||||
for (int x = 0; x < code->size; x++) {
|
||||
if (grid_bit(code, y, x)) {
|
||||
flipped.cell_bitmap[offset >> 3u] |= (1u << (offset & 7u));
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue