Skip to content

Commit c0d6bfe

Browse files
committed
1.1: simplify hammingdec
1 parent 2bcdcf1 commit c0d6bfe

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

hammingdec.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@ void kontrolbit(int *kod, int lengh)
2626
}
2727
i++;
2828
}
29-
if(errorpos != 0)
30-
{
31-
if(kod[errorpos] == 0)
32-
kod[errorpos] = 1;
33-
else
34-
kod[errorpos] = 0;
35-
}
29+
kod[errorpos] = (errorpos != 0) ? !kod[errorpos] : kod[errorpos];
3630
}
3731

3832
void invert(int *byte)

0 commit comments

Comments
 (0)