mirror of https://github.com/golang/go.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
This commit is contained in:
parent
c1fc8d5296
commit
0a4fc122de
|
|
@ -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) */
|
||||
|
|
|
|||
Loading…
Reference in New Issue