February 06, 2015 ubyte array to uint? | ||||
|---|---|---|---|---|
| ||||
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. | ||||
February 06, 2015 Re: ubyte array to uint? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Gan | 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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply