Re: sys/dev/x86emu/x86emu.c: repair "} if"

2019-03-31 Thread Theo de Raadt
Yes, very weird.

There are about 20 more in the base tree.

Some of them are missing "else", but some are not.

> I'm grepping the tree for "} if" lines...
> 
> I'm confident that these were intended as "else if", compare the
> corresponding ror_* functions.  Also, it doesn't actually change
> the result.
> 
> ok?
> 
> Index: sys/dev/x86emu/x86emu.c
> ===
> RCS file: /cvs/src/sys/dev/x86emu/x86emu.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 x86emu.c
> --- sys/dev/x86emu/x86emu.c   25 Nov 2018 19:52:08 -  1.10
> +++ sys/dev/x86emu/x86emu.c   1 Apr 2019 03:50:28 -
> @@ -7009,7 +7009,7 @@ rol_byte(struct x86emu *emu, uint8_t d, 
>   CONDITIONAL_SET_FLAG(s == 1 &&
>   XOR2((res & 0x1) + ((res >> 6) & 0x2)),
>   F_OF);
> - } if (s != 0) {
> + } else if (s != 0) {
>   /* set the new carry flag, Note that it is the low order bit
>* of the result!!!   */
>   CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
> @@ -7035,7 +7035,7 @@ rol_word(struct x86emu *emu, uint16_t d,
>   CONDITIONAL_SET_FLAG(s == 1 &&
>   XOR2((res & 0x1) + ((res >> 14) & 0x2)),
>   F_OF);
> - } if (s != 0) {
> + } else if (s != 0) {
>   /* set the new carry flag, Note that it is the low order bit
>* of the result!!!   */
>   CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
> @@ -7061,7 +7061,7 @@ rol_long(struct x86emu *emu, uint32_t d,
>   CONDITIONAL_SET_FLAG(s == 1 &&
>   XOR2((res & 0x1) + ((res >> 30) & 0x2)),
>   F_OF);
> - } if (s != 0) {
> + } else if (s != 0) {
>   /* set the new carry flag, Note that it is the low order bit
>* of the result!!!   */
>   CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de
> 



sys/dev/x86emu/x86emu.c: repair "} if"

2019-03-31 Thread Christian Weisgerber
I'm grepping the tree for "} if" lines...

I'm confident that these were intended as "else if", compare the
corresponding ror_* functions.  Also, it doesn't actually change
the result.

ok?

Index: sys/dev/x86emu/x86emu.c
===
RCS file: /cvs/src/sys/dev/x86emu/x86emu.c,v
retrieving revision 1.10
diff -u -p -r1.10 x86emu.c
--- sys/dev/x86emu/x86emu.c 25 Nov 2018 19:52:08 -  1.10
+++ sys/dev/x86emu/x86emu.c 1 Apr 2019 03:50:28 -
@@ -7009,7 +7009,7 @@ rol_byte(struct x86emu *emu, uint8_t d, 
CONDITIONAL_SET_FLAG(s == 1 &&
XOR2((res & 0x1) + ((res >> 6) & 0x2)),
F_OF);
-   } if (s != 0) {
+   } else if (s != 0) {
/* set the new carry flag, Note that it is the low order bit
 * of the result!!!   */
CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
@@ -7035,7 +7035,7 @@ rol_word(struct x86emu *emu, uint16_t d,
CONDITIONAL_SET_FLAG(s == 1 &&
XOR2((res & 0x1) + ((res >> 14) & 0x2)),
F_OF);
-   } if (s != 0) {
+   } else if (s != 0) {
/* set the new carry flag, Note that it is the low order bit
 * of the result!!!   */
CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
@@ -7061,7 +7061,7 @@ rol_long(struct x86emu *emu, uint32_t d,
CONDITIONAL_SET_FLAG(s == 1 &&
XOR2((res & 0x1) + ((res >> 30) & 0x2)),
F_OF);
-   } if (s != 0) {
+   } else if (s != 0) {
/* set the new carry flag, Note that it is the low order bit
 * of the result!!!   */
CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
-- 
Christian "naddy" Weisgerber  na...@mips.inka.de