convert ubyte[k..k + 1] to int

Robert DaSilva spunit262 at yahoo.com
Wed May 16 17:32:55 PDT 2012


On Wednesday, 16 May 2012 at 18:47:55 UTC, Jonathan M Davis wrote:
> As long as you're going from big endian to little endian,
> std.bitmanip.bigEndianToNative will do the conversion fairly 
> easily, but if
> they're in little endian, then the nasty casting is the way to 
> go.
>
> - Jonathan M Davis

Except they don't take slices. You need a helper function.

ubyte[2] _2(ubyte[] a){ubyte[2] b; assert(a.length==2); b[]=a; 
return b;}



More information about the Digitalmars-d-learn mailing list