Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Remove unnecessary ternary operator in m32c-tdep.c
@ 2018-08-20 14:33 Simon Marchi
  2018-08-20 22:27 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2018-08-20 14:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Bug 17816 pointed out a useless use of the ternary operator:

  case 0x0: sd.reg = (size == 1 ? &st->r0 : &st->r0); break;

I believe that this is right.  If size is 1, the instruction refers to
part of r0, while if size is 2, the instruction refers to the whole of
r0.

gdb/ChangeLog:

	PR gdb/17816
	* m32c-tdep.c (m32c_decode_srcdest4): Remove unnecessary ternary
	operator.
---
 gdb/m32c-tdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index fc6277e..6fa2445 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -1236,7 +1236,7 @@ m32c_decode_srcdest4 (struct m32c_pv_state *st,
 
   switch (code)
     {
-    case 0x0: sd.reg = (size == 1 ? &st->r0 : &st->r0); break;
+    case 0x0: sd.reg = &st->r0; break;
     case 0x1: sd.reg = (size == 1 ? &st->r0 : &st->r1); break;
     case 0x2: sd.reg = (size == 1 ? &st->r1 : &st->r2); break;
     case 0x3: sd.reg = (size == 1 ? &st->r1 : &st->r3); break;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-21 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 14:33 [PATCH] Remove unnecessary ternary operator in m32c-tdep.c Simon Marchi
2018-08-20 22:27 ` Kevin Buettner
2018-08-21 14:55   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox