bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extending ntoab to support LONG_MIN case - patch


From: Danny Milosavljevic
Subject: Extending ntoab to support LONG_MIN case - patch
Date: Wed, 27 May 2020 20:35:21 +0200

Hi,

in mes on branch "wip-arm" some tests were failing because ntoab didn't support
converting INT_MIN to string.

I pushed a fix to wip-arm as commit c4d6bc4668a0d431d2f94adde3cbdb7757596fc4.

For reference, it is this commit:

diff --git a/lib/mes/ntoab.c b/lib/mes/ntoab.c
index ce91c73a..e2689742 100644
--- a/lib/mes/ntoab.c
+++ b/lib/mes/ntoab.c
@@ -20,10 +20,16 @@
 
 #include <assert.h>
 #include <mes/lib.h>
+#include <stdint.h>
+
+#define STR(x) #x
+#define XSTR(s) STR(s)
 
 char *
 ntoab (long x, int base, int signed_p)
 {
+  if (x == LONG_MIN)
+    return XSTR(LONG_MIN);
   static char itoa_buf[20];
   char *p = itoa_buf + 11;
   *p-- = 0;

Attachment: pgpxl5m8L1Ali.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]