]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
tekhex.c tidy writesym
authorAlan Modra <amodra@gmail.com>
Thu, 24 Oct 2024 07:44:52 +0000 (18:14 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 25 Oct 2024 23:58:10 +0000 (10:28 +1030)
Simplifies the code a little.  No functional changes.

bfd/tekhex.c

index 16e8e1855726614a5f9adfe43cd97e40e4c75961..aea2ebb23dfecdab012754676548bdae219d0e83 100644 (file)
@@ -736,22 +736,14 @@ writesym (char **dst, const char *sym)
   int len = (sym ? strlen (sym) : 0);
 
   if (len >= 16)
+    len = 16;
+  else if (len == 0)
     {
-      *p++ = '0';
-      len = 16;
-    }
-  else
-    {
-      if (len == 0)
-       {
-         *p++ = '1';
-         sym = "$";
-         len = 1;
-       }
-      else
-       *p++ = digs[len];
+      len = 1;
+      sym = "$";
     }
 
+  *p++ = digs[len & 0xf];
   while (len--)
     *p++ = *sym++;