From: Russ Cox Date: Sun, 30 Jun 2013 23:53:36 +0000 (-0400) Subject: lib9: restore printing of signed integers X-Git-Tag: go1.2rc2~1136 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0a4fc122de2d0c5da7e89feb7c079e602612a2fd;p=gostls13.git lib9: restore printing of signed integers A casualty of https://golang.org/cl/10195044. If x is an 32-bit int and u is a 64-bit ulong, u = (uint)x // converts to uint before extension, so zero fills u = (ulong)x // sign-extends TBR=iant, r CC=golang-dev https://golang.org/cl/10814043 --- diff --git a/src/lib9/fmt/dofmt.c b/src/lib9/fmt/dofmt.c index 95f378704a..94a91a2aac 100644 --- a/src/lib9/fmt/dofmt.c +++ b/src/lib9/fmt/dofmt.c @@ -387,17 +387,17 @@ __ifmt(Fmt *f) if(fl & FmtUnsigned) u = (uchar)va_arg(f->args, int); else - u = (uchar)(char)va_arg(f->args, int); + u = (ulong)(char)va_arg(f->args, int); }else if(fl & FmtShort){ if(fl & FmtUnsigned) u = (ushort)va_arg(f->args, int); else - u = (ushort)(short)va_arg(f->args, int); + u = (ulong)(short)va_arg(f->args, int); }else{ if(fl & FmtUnsigned) u = va_arg(f->args, uint); else - u = (uint)va_arg(f->args, int); + u = (ulong)va_arg(f->args, int); } conv = "0123456789abcdef"; grouping = "\4"; /* for hex, octal etc. (undefined by spec but nice) */