On 12/1/2011 12:45 AM, Don Clugston wrote:

The hex digits are 4 higher than they should be, in every case.
'0'->  '4', '2'->'6', '9' ->  'D', etc.
The hex digits are set in this function:

void toHexZeroPadded(char[] output, uint value)
{
     ptrdiff_t x = output.length - 1;
     static immutable string hexDigits = "0123456789ABCDEF";
     for( ; x>=0; --x)
     {
         output[x] = hexDigits[value&  0xF];
         value>>= 4;
     }
}

This really looks as though hexDigits is the wrong address. Maybe
because it's a local static variable.
I predict that a minimal test case would be:

void foo(uint value)
{
     static immutable string hexDigits = "0123456789ABCDEF";
     assert( hexDigits[value&  0xF] == '0');
}
void main()
{
   foo(0);
}
_______________________________________________


I tried various iterations on this and can't get a failure. Grrrr...
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to