 |
Changeset 3683
- 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
| r3588 |
r3683 |
|
| 67 | 67 | static uint hash(K) (K k, uint length) |
|---|
| 68 | 68 | { |
|---|
| 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; |
|---|
| 70 | 77 | } |
|---|
| 71 | 78 | |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic