digitalmars.D.bugs - Bugzilla #113 fix - ineffective code (dmd161)
- Bob W (53/53) Jun 23 2006 Although working - the fix to bug #113 contains partly
"src\phobos\std\format.d".
It might be worthwhile to consider re-using original code
code found in the std.format module:
-----------
if (vnumber < base)
{
if (vnumber == 0 && precision == 0 && flags & FLprecision &&
!(fc == 'o' && flags & FLhash))
{
putstr(null);
return;
}
if (precision == 0 || !(flags & FLprecision))
{ vchar = '0' + vnumber;
if (vnumber < 10)
vchar = '0' + vnumber;
else
vchar = (uc ? 'A' - 10 : 'a' - 10) + vnumber;
goto L2;
}
}
int n = tmpbuf.length;
char c;
int hexoffset = uc ? ('A' - ('9' + 1)) : ('a' - ('9' + 1));
-----------
int hexoffset = uc ? ('A' - ('9' + 1)) : ('a' - ('9' + 1));
if (vnumber < base)
{
if (vnumber == 0 && precision == 0 && flags & FLprecision &&
!(fc == 'o' && flags & FLhash))
{
putstr(null);
return;
}
if (precision == 0 || !(flags & FLprecision))
{
vchar = '0' + vnumber;
if (vnumber > 9)
vchar += hexoffset;
goto L2;
}
}
int n = tmpbuf.length;
char c;
-----------
Note: The line containing "int hexoffset = ..." needs to be moved
up to line 866, then hexoffset can be used the same way as it is
done already in subsequent parts of the module's code.
Jun 23 2006








"Bob W" <nospam aol.com>