public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: m68hc11: clean up pointer casts
@ 2021-11-01  4:07 Mike Frysinger
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2021-11-01  4:07 UTC (permalink / raw)
  To: gdb-patches

The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an integer.  Fix up the
casts to avoid using (long) to cast to/from pointers since there
is no guarantee that's the right size.
---
 sim/m68hc11/dv-m68hc11tim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sim/m68hc11/dv-m68hc11tim.c b/sim/m68hc11/dv-m68hc11tim.c
index 2c2e523da11f..08604d314435 100644
--- a/sim/m68hc11/dv-m68hc11tim.c
+++ b/sim/m68hc11/dv-m68hc11tim.c
@@ -260,7 +260,7 @@ m68hc11tim_timer_event (struct hw *me, void *data)
   controller = hw_data (me);
   sd         = hw_system (me);
   cpu        = STATE_CPU (sd, 0);
-  type       = (enum event_type) ((long) data) & 0x0FF;
+  type       = (enum event_type) ((uintptr_t) data) & 0x0FF;
   events     = STATE_EVENTS (sd);
 
   delay = 0;
@@ -280,7 +280,7 @@ m68hc11tim_timer_event (struct hw *me, void *data)
       eventp = &controller->rti_timer_event;
       delay  = controller->rti_prev_interrupt + controller->rti_delay;
       
-      if (((long) (data) & 0x0100) == 0)
+      if (((uintptr_t) data & 0x0100) == 0)
         {
           cpu->ios[M6811_TFLG2] |= M6811_RTIF;
           check_interrupt = 1;
@@ -308,7 +308,7 @@ m68hc11tim_timer_event (struct hw *me, void *data)
       delay += events->nr_ticks_to_process;
 
       eventp = &controller->tof_timer_event;
-      if (((long) (data) & 0x100) == 0)
+      if (((uintptr_t) data & 0x100) == 0)
         {
           cpu->ios[M6811_TFLG2] |= M6811_TOF;
           check_interrupt = 1;
-- 
2.33.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-01  4:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01  4:07 [PATCH] sim: m68hc11: clean up pointer casts Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).