]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
z80: use signed char for relative offset
authorAlan Modra <amodra@gmail.com>
Sun, 8 Mar 2026 12:14:23 +0000 (22:44 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 8 Mar 2026 22:03:51 +0000 (08:33 +1030)
A char is signed on some hosts, unsigned on others.

* z80-dis.c (prt_e): Don't use plain char for offset.

opcodes/z80-dis.c

index 0c0c19092a2845ac6a9ba1ff5f94058ecf54df14..d5b4c4210d0c3210fff47c6b234ab20175205cf1 100644 (file)
@@ -111,13 +111,10 @@ prt (struct buffer *buf, disassemble_info * info, const char *txt)
 static int
 prt_e (struct buffer *buf, disassemble_info * info, const char *txt)
 {
-  char e;
-  int target_addr;
-
   if (fetch_data (buf, info, 1))
     {
-      e = buf->data[1];
-      target_addr = (buf->base + 2 + e) & 0xffff;
+      signed char e = buf->data[1];
+      int target_addr = (buf->base + 2 + e) & 0xffff;
       buf->n_used = buf->n_fetch;
       info->fprintf_func (info->stream, "%s0x%04x", txt, target_addr);
     }