Please take a look
    Lukas Pinkowski 
    Lukas.Pinkowski at web.de
       
    Sat Dec 22 09:18:30 PST 2007
    
    
  
bearophile wrote:
> Can you 
> show me an example where if shows the bug?
int main(char[][] args)
{
   Uint24[4] array;
   array[0] = 0xffffff;
   array[1] = 0x000000;
   array[2] = 0xeeeeee;
   array[3] = 0xffffff;
   
   uint a = array[0].val;
   uint b = array[1].val;
   uint c = array[2].val;
   
   Stdout.formatln( "{:x}", a );
   Stdout.formatln( "{:x}", b );
   Stdout.formatln( "{:x}", c );
   
   assert( a == 0x00ffffff );
   assert( b == 0x00000000 );
   assert( c == 0x00ffffff );
   
   return 0;
}
Executing gives:
ffffff
ee000000
ffeeeeee
tango.core.Exception.AssertException at bug24(62): Assertion failure
As you see, taking the value of one array element will return the Uint24
value + the first byte of the next array element (shifted 24bits to the
left). (the first is correct because 0xffffff + (0x000000 << 24) is
0x00ffffff)
    
    
More information about the Digitalmars-d-learn
mailing list