Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3683

Show
Ignore:
Timestamp:
06/28/08 19:57:54 (2 months ago)
Author:
kris
Message:

added optimization from mwarning

Thanks for that!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/util/container/Container.d

    r3588 r3683  
    6767        static uint hash(K) (K k, uint length) 
    6868        { 
    69                 return (typeid(K).getHash(&k) & 0x7FFFFFFF) % length; 
     69                static if (is(K : int) || is(K : uint) ||  
     70                           is(K : long) || is(K : ulong) ||  
     71                           is(K : short) || is(K : ushort) || 
     72                           is(K : byte) || is(K : ubyte) || 
     73                           is(K : char) || is(K : wchar) || is (K : dchar)) 
     74                           return cast(uint) (k % length); 
     75                else 
     76                   return (typeid(K).getHash(&k) & 0x7FFFFFFF) % length; 
    7077        } 
    7178