diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-11-11 19:36:28 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-11-13 00:57:00 -0500 |
commit | 35f7d33dd99346dd368fd7bdbc251001130b86cf (patch) | |
tree | 1fd091aa8d28334583e6d67f1dc36988bccb4be1 | |
parent | dc5a4621600e650b89deb92c79eaacc73fcc767a (diff) | |
download | gdb-35f7d33dd99346dd368fd7bdbc251001130b86cf.zip gdb-35f7d33dd99346dd368fd7bdbc251001130b86cf.tar.gz gdb-35f7d33dd99346dd368fd7bdbc251001130b86cf.tar.bz2 |
sim: sh: fix switch-bool warnings
This code triggers -Werror=switch-bool warnings with <=gcc-5 versions.
Rework it to use if statements instead as it also simplifies a bit.
-rw-r--r-- | sim/sh/interp.c | 79 |
1 files changed, 28 insertions, 51 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 93923fa..559b39a 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -1104,74 +1104,51 @@ div1 (int *R, int iRn2, int iRn1/*, int T*/) R[iRn1] <<= 1; R[iRn1] |= (unsigned long) T; - switch (old_q) + if (!old_q) { - case 0: - switch (M) + if (!M) { - case 0: tmp0 = R[iRn1]; R[iRn1] -= R[iRn2]; tmp1 = (R[iRn1] > tmp0); - switch (Q) - { - case 0: - SET_SR_Q (tmp1); - break; - case 1: - SET_SR_Q ((unsigned char) (tmp1 == 0)); - break; - } - break; - case 1: + if (!Q) + SET_SR_Q (tmp1); + else + SET_SR_Q ((unsigned char) (tmp1 == 0)); + } + else + { tmp0 = R[iRn1]; R[iRn1] += R[iRn2]; tmp1 = (R[iRn1] < tmp0); - switch (Q) - { - case 0: - SET_SR_Q ((unsigned char) (tmp1 == 0)); - break; - case 1: - SET_SR_Q (tmp1); - break; - } - break; + if (!Q) + SET_SR_Q ((unsigned char) (tmp1 == 0)); + else + SET_SR_Q (tmp1); } - break; - case 1: - switch (M) + } + else + { + if (!M) { - case 0: tmp0 = R[iRn1]; R[iRn1] += R[iRn2]; tmp1 = (R[iRn1] < tmp0); - switch (Q) - { - case 0: - SET_SR_Q (tmp1); - break; - case 1: - SET_SR_Q ((unsigned char) (tmp1 == 0)); - break; - } - break; - case 1: + if (!Q) + SET_SR_Q (tmp1); + else + SET_SR_Q ((unsigned char) (tmp1 == 0)); + } + else + { tmp0 = R[iRn1]; R[iRn1] -= R[iRn2]; tmp1 = (R[iRn1] > tmp0); - switch (Q) - { - case 0: - SET_SR_Q ((unsigned char) (tmp1 == 0)); - break; - case 1: - SET_SR_Q (tmp1); - break; - } - break; + if (!Q) + SET_SR_Q ((unsigned char) (tmp1 == 0)); + else + SET_SR_Q (tmp1); } - break; } /*T = (Q == M);*/ SET_SR_T (Q == M); |