How to convert ubyte[] to uint?
Dr.No
jckj33 at gmail.com
Wed May 23 19:36:07 UTC 2018
read fails with both uint and ulong on 64bit platform:
Error: template std.bitmanip.read cannot deduce function from
argument types !(ulong)(ubyte[8]), candidates are:
C:\ldc2-1.9.0-windows-x64\bin\..\import\std\bitmanip.d(3213,3):
std.bitmanip.read(T, Endian endianness = Endian.bigEndian,
R)(ref R range) if (canSwapEndianness!T && isInputRange!R &&
is(ElementType!R : const(ubyte)))
code:
import digestx.fnv;
import std.bitmanip : read;
FNV64 fnv64;
fnv64.start();
fnv64.put(cast(ubyte[])word);
ubyte[8] arr = fnv64.finish();
auto h = arr.read!ulong;
return cast(uint)h;
More information about the Digitalmars-d-learn
mailing list