Subject: Re: bin/1325: tip computes parity wrong for zero parity
To: None <netbsd-bugs@NetBSD.ORG>
From: Christos Zoulas <christos@deshaw.com>
List: netbsd-bugs
Date: 08/09/1995 17:48:33
In article <199508091531.LAA00960@protagoras.eecs.harvard.edu> tlb@protagoras.eecs.harvard.edu writes:
>
>>Fix:
>The error was a misunderstanding of C precedence rules; here is the
>fix.
>
>*** /usr/src/usr.bin/tip/tip.c       Wed Aug  9 11:05:19 1995
>--- /usr/src/usr.bin/tip/tip.c-orig  Wed Aug  9 11:04:56 1995
>***************
>*** 600,604 ****
>                (void) fflush(stderr);
>        }
>        for (i = 0; i < 0200; i++)
>!               partab[i] = (evenpartab[i] ^ flip | set) & clr;
>  }
>--- 600,604 ----
>                (void) fflush(stderr);
>        }
>        for (i = 0; i < 0200; i++)
>!               partab[i] = evenpartab[i] ^ flip | set & clr;
>  }
>

I don't like this fix. I prefer to see the parentheses, rather than
depending on the implied precedence.

              partab[i] = (evenpartab[i] ^ flip) | (set & clr);

[Again I did not check the table, so my parentheses might be wrong].

christos