]> git.sesse.net Git - hamming/commitdiff
Flip the extra-parity checks in the double-bit code checking code again; it appears...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 2 Mar 2006 13:26:48 +0000 (13:26 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 2 Mar 2006 13:26:48 +0000 (13:26 +0000)
hamming32.c

index 69619c60737e89ea3b7d1b1b2ddc3ac4304a80ba..a27725318e5fab6893bcb653dd89c9162afb2abc 100644 (file)
@@ -79,15 +79,15 @@ int has_double_error(unsigned code)
        unsigned extra_parity = find_parity_32(code);
 
        /* no errors at all (user should have used has_error() first; boo, hiss) */
-       if (hamming_parity == gen_hamming_parity && extra_parity == 1)
+       if (hamming_parity == gen_hamming_parity && extra_parity == 0)
                return 0;
 
        /* both hamming and simple parity errors; this is a single-bit error */
-       if (hamming_parity != gen_hamming_parity && extra_parity == 0)
+       if (hamming_parity != gen_hamming_parity && extra_parity == 1)
                return 0;
 
        /* hamming says OK, but simple parity indicates an error => simple parity error is wrong */
-       if (hamming_parity == gen_hamming_parity && extra_parity == 0)
+       if (hamming_parity == gen_hamming_parity && extra_parity == 1)
                return 0;
 
        /* hamming says error, simple parity says OK => DOUBLE ERROR */