mirror of
https://github.com/golang/go
synced 2024-11-18 18:04:46 -07:00
export large constants
R=r DELTA=37 (31 added, 4 deleted, 2 changed) OCL=14089 CL=14089
This commit is contained in:
parent
cbaca0be24
commit
2b75556436
@ -78,7 +78,7 @@ dumpexportconst(Sym *s)
|
||||
case CTINT:
|
||||
case CTSINT:
|
||||
case CTUINT:
|
||||
Bprint(bout, "0x%llux\n", mpgetfix(n->val.u.xval));
|
||||
Bprint(bout, "%B\n", n->val.u.xval);
|
||||
break;
|
||||
case CTBOOL:
|
||||
Bprint(bout, "0x%llux\n", n->val.u.bval);
|
||||
|
@ -487,6 +487,7 @@ void mpatofix(Mpint *a, char *s);
|
||||
void mpatoflt(Mpflt *a, char *s);
|
||||
void mpmovefltfix(Mpint *a, Mpflt *b);
|
||||
void mpmovefixflt(Mpflt *a, Mpint *b);
|
||||
int Bconv(Fmt*);
|
||||
|
||||
/*
|
||||
* mparith2.c
|
||||
|
@ -52,6 +52,7 @@ mainlex(int argc, char *argv[])
|
||||
fmtinstall('N', Nconv); // node pointer
|
||||
fmtinstall('Z', Zconv); // escaped string
|
||||
fmtinstall('L', Lconv); // line number
|
||||
fmtinstall('B', Bconv); // big numbers
|
||||
|
||||
lexinit();
|
||||
lineno = 1;
|
||||
|
@ -348,3 +348,32 @@ bad:
|
||||
warn("set ovf in mpatov: %s", as);
|
||||
mpmovecfix(a, 0);
|
||||
}
|
||||
|
||||
int
|
||||
Bconv(Fmt *fp)
|
||||
{
|
||||
char buf[500], *p;
|
||||
Mpint *xval, q, r, ten;
|
||||
int f;
|
||||
|
||||
xval = va_arg(fp->args, Mpint*);
|
||||
mpmovefixfix(&q, xval);
|
||||
f = 0;
|
||||
if(mptestfix(&q) < 0) {
|
||||
f = 1;
|
||||
mpnegfix(&q);
|
||||
}
|
||||
mpmovecfix(&ten, 10);
|
||||
|
||||
p = &buf[sizeof(buf)];
|
||||
*--p = 0;
|
||||
for(;;) {
|
||||
mpdivmodfixfix(&q, &r, &q, &ten);
|
||||
*--p = mpgetfix(&r) + '0';
|
||||
if(mptestfix(&q) <= 0)
|
||||
break;
|
||||
}
|
||||
if(f)
|
||||
*--p = '-';
|
||||
return fmtstrcpy(fp, p);
|
||||
}
|
||||
|
@ -1053,13 +1053,9 @@ Nconv(Fmt *fp)
|
||||
snprint(buf1, sizeof(buf1), "LITERAL-ctype=%d", n->val.ctype);
|
||||
break;
|
||||
case CTINT:
|
||||
snprint(buf1, sizeof(buf1), "I%lld", mpgetfix(n->val.u.xval));
|
||||
break;
|
||||
case CTSINT:
|
||||
snprint(buf1, sizeof(buf1), "S%lld", mpgetfix(n->val.u.xval));
|
||||
break;
|
||||
case CTUINT:
|
||||
snprint(buf1, sizeof(buf1), "U%lld", mpgetfix(n->val.u.xval));
|
||||
snprint(buf1, sizeof(buf1), "I%B", n->val.u.xval);
|
||||
break;
|
||||
case CTFLT:
|
||||
snprint(buf1, sizeof(buf1), "F%g", mpgetflt(n->val.u.fval));
|
||||
|
Loading…
Reference in New Issue
Block a user