Johannes Pfau wrote:
> Am Thu, 23 Aug 2012 22:46:35 +0200
> schrieb Jens Mueller <jens.k.muel...@gmx.de>:
> 
> > 
> > It says "Digests do not work in CTFE".
> > Just checked it for MD5.
> > I do not know but I think this is just a current limitation of the
> > CTFE implementation.
> 
> It's possible to support CTFE, Piotr Szturmaj has some digests which
> work in CTFE. But it's difficult as everything which depends on
> endianness isn't supported in CTFE.
> 
> https://github.com/pszturmaj/phobos/commit/d06c258b442c5b59ab3a66125c9aea8a4c00a0b7
> 
> take for example the setByte function:
> a[offset / E.sizeof] |= value << ((offset % E.sizeof) * 8);
> This is necessary because you can't cast from uint to ubyte[4] in CTFE.

I see.
Though I do not understand that limitation of CTFE. Since D has
version(LittleEndian) and version(BigEndian) and CTFE should follow
versioning I see no reason why casts that depend on endianness should
not be supported. When writing a function you have to care about
endianness anyway.

Jens

Reply via email to