ubyte array to uint?
weaselcat via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 5 21:45:28 PST 2015
On Friday, 6 February 2015 at 05:18:45 UTC, Gan wrote:
> Is there a simple way of conversion? Something like:
> uint length = to!uint(buffer[0 .. 4]);
>
> Right now I have:
> uint length = *cast(uint*)buffer[0 .. 4].ptr;
>
> Which I'm not entirely sure is the correct way to do that.
Hi,
check out std.bitmanip.read
http://dlang.org/phobos/std_bitmanip.html#.read
More information about the Digitalmars-d-learn
mailing list