Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1627 from WalterBright/hash-system
Browse files Browse the repository at this point in the history
@trusted function is really @System
  • Loading branch information
andralex committed Aug 11, 2016
2 parents 49f9d5d + c9dacd5 commit a16381c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/internal/hash.d
Expand Up @@ -432,8 +432,9 @@ version(AnyX86)
}
}

@trusted pure nothrow @nogc
size_t bytesHash(const(void)* buf, size_t len, size_t seed = 0)

@system pure nothrow @nogc
size_t bytesHash(const(void)* buf, size_t len, size_t seed)
{
static uint rotl32(uint n)(in uint x) pure nothrow @safe @nogc
{
Expand Down Expand Up @@ -520,14 +521,14 @@ size_t bytesHash(const(void)* buf, size_t len, size_t seed = 0)
}

// Check that bytesHash works with CTFE
pure nothrow @safe @nogc unittest
pure nothrow @system @nogc unittest
{
size_t ctfeHash(string x)
{
return bytesHash(x.ptr, x.length);
return bytesHash(x.ptr, x.length, 0);
}

enum test_str = "Sample string";
enum size_t hashVal = ctfeHash(test_str);
assert(hashVal == bytesHash(&test_str[0], test_str.length));
assert(hashVal == bytesHash(&test_str[0], test_str.length, 0));
}

0 comments on commit a16381c

Please sign in to comment.