[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ntoab: Handle LONG_MIN case.
From: |
Jan Nieuwenhuizen |
Subject: |
Re: [PATCH] ntoab: Handle LONG_MIN case. |
Date: |
Wed, 03 Jun 2020 08:02:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Danny Milosavljevic writes:
> * lib/mes/ntoab.c (ntoab): Handle LONG_MIN case.
> ---
> lib/mes/ntoab.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/mes/ntoab.c b/lib/mes/ntoab.c
> index ce91c73a..382e2326 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 && base == 10)
> + return XSTR(LONG_MIN);
Wondering what happens if base == 8, or base == 16 and x == LONG_MIN?
Otherwise, LGTM
Janneke
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com