diff options
| author | Eugen Wissner <belka@caraus.de> | 2018-03-19 17:18:02 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2018-03-27 05:09:22 +0200 |
| commit | 442fa5b46a2f3fd8c70e68dce870ac961198cc63 (patch) | |
| tree | 8830357655e5fbc482e70cf4905c9fe1988f805f /source | |
| parent | 0d6d8f6a9111ea54b8c148135f69a060ddcb534d (diff) | |
| download | tanya-442fa5b46a2f3fd8c70e68dce870ac961198cc63.tar.gz | |
Fix hashing scalar types
Diffstat (limited to 'source')
| -rw-r--r-- | source/tanya/hash/lookup.d | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/tanya/hash/lookup.d b/source/tanya/hash/lookup.d index 643601e..817670b 100644 --- a/source/tanya/hash/lookup.d +++ b/source/tanya/hash/lookup.d @@ -40,7 +40,7 @@ private struct FNV { static if (isScalarType!T) { - (() @trusted => add(cast(const ubyte[]) (&key)[0 .. T.sizeof]))(); + (() @trusted => add((cast(const ubyte*) &key)[0 .. T.sizeof]))(); } else static if (isArray!T && isScalarType!(ElementType!T)) { @@ -162,12 +162,14 @@ static if (size_t.sizeof == 4) @nogc nothrow pure @safe unittest { assert(hash('a') == 0xe40c292cU); assert(hash(HashRange()) == 0x6222e842U); + assert(hash(ToHashRange()) == 1268118805U); } static if (size_t.sizeof == 8) @nogc nothrow pure @safe unittest { assert(hash('a') == 0xaf63dc4c8601ec8cUL); assert(hash(HashRange()) == 0x08985907b541d342UL); + assert(hash(ToHashRange()) == 12161962213042174405UL); } /* |
