digitalmars.D.learn - Can I work out error: reinterpreting cast from const(ubyte)* to
- Dr.No (6/7) May 21 2018 I'm trying to do some hashing at compile time with xxhash
- Jonathan M Davis (13/22) May 21 2018 You can't do any kind of pointer manipulaton or related casts in CTFE. S...
I'm trying to do some hashing at compile time with xxhash algorithm but I get this error: ..\..\..\AppData\Local\dub\packages\xxhash-master\xxhash\src\xxhash.d(39,37): Error: reinterpreting cast from const(ubyte)* to const(uint)* is not supported in CTFE this is line 39 (https://github.com/repeatedly/xxhash-d/blob/master/src/xxhash.d#L39):auto srcPtr = cast(const(uint)*)source.ptr;I'm on Windows 10 64-bit machine.
May 21 2018
On Monday, May 21, 2018 18:13:26 Dr.No via Digitalmars-d-learn wrote:I'm trying to do some hashing at compile time with xxhash algorithm but I get this error: ..\..\..\AppData\Local\dub\packages\xxhash-master\xxhash\src\xxhash.d(39,3 7): Error: reinterpreting cast from const(ubyte)* to const(uint)* is not supported in CTFE this is line 39 (https://github.com/repeatedly/xxhash-d/blob/master/src/xxhash.d#L39):You can't do any kind of pointer manipulaton or related casts in CTFE. So, you can't reinterpet one type as another at compile time. You would need a different hashing algorithm for CTFE - e.g. if(__ctfe) { ... do something to calculate a hash } else { ... calculate the hash the current way } - Jonathan M Davisauto srcPtr = cast(const(uint)*)source.ptr;I'm on Windows 10 64-bit machine.
May 21 2018