Thread overview
std.digest
Oct 17, 2018
Márcio Martins
Oct 17, 2018
rikki cattermole
Nov 22, 2018
Stefan Koch
October 17, 2018
Hi!

To my surprise, std.digest.MurmurHash3 doesn't work in CTFE.

Would it be hard to have it explicit in the documentation if a particular Phobos symbol works in CTFE? Maybe it could be manual, and vote-based, to avoid building infrastructure around it.

Also, MurmurHash3 only outputs 32-bit or 128-bit hashes, which leaves us without any modern fast 64-bit digest. Would anyone oppose pulling an XXHash implementation into Phobos?

October 17, 2018
On 17/10/2018 10:36 PM, Márcio Martins wrote:
> Hi!
> 
> To my surprise, std.digest.MurmurHash3 doesn't work in CTFE.
> 
> Would it be hard to have it explicit in the documentation if a particular Phobos symbol works in CTFE? Maybe it could be manual, and vote-based, to avoid building infrastructure around it.

It uses a union, that is why it doesn't work at CTFE. Hopefully newCTFE can solve that one.

> Also, MurmurHash3 only outputs 32-bit or 128-bit hashes, which leaves us without any modern fast 64-bit digest. Would anyone oppose pulling an XXHash implementation into Phobos?

A better question is why doesn't it support 64bit?

November 22, 2018
On Wednesday, 17 October 2018 at 09:43:16 UTC, rikki cattermole wrote:
> It uses a union, that is why it doesn't work at CTFE. Hopefully newCTFE can solve that one.

unions work at ctfe.
it's type punning using unions which does not work.
And there are no plans to support that at newCTFE, since it invokes platform-dependent behavior.

It is a pretty bad idea include non-standardized platform-dependent-behavior when forming literals.