]> www.ginac.de Git - cln.git/commitdiff
Fix long-standing bug in the "signed" variants of fprinthexadecimal.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Nov 2019 00:32:13 +0000 (01:32 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 18 Nov 2019 00:49:46 +0000 (01:49 +0100)
src/base/output/cl_output_hex.cc

index d71994feadbb452709be23dfb2d17b8059eb4efc..69a6f56e0536aab05c4b59fa13990d4a5dfe292e 100644 (file)
@@ -30,10 +30,10 @@ static void fprinthexadecimal_impl (std::ostream& stream, uintptr_t x)
 static void fprinthexadecimal_impl (std::ostream& stream, intptr_t x)
 {
        if (x >= 0)
-               fprintdecimal(stream,(uintptr_t)x);
+               fprinthexadecimal(stream,(uintptr_t)x);
        else {
                fprintchar(stream,'-');
-               fprintdecimal(stream,(uintptr_t)(-1-x)+1);
+               fprinthexadecimal(stream,(uintptr_t)(-1-x)+1);
        }
 }
 
@@ -83,10 +83,10 @@ void fprinthexadecimal (std::ostream& stream, long long x)
        fprinthexadecimal_impl(stream,(intptr_t)x);
 #else
        if (x >= 0)
-               fprintdecimal(stream,(unsigned long long)x);
+               fprinthexadecimal(stream,(unsigned long long)x);
        else {
                fprintchar(stream,'-');
-               fprintdecimal(stream,(unsigned long long)(-1-x)+1);
+               fprinthexadecimal(stream,(unsigned long long)(-1-x)+1);
        }
 #endif
 }