In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] = cast(ubyte[4])num;
How do I do that in D1?
IIRC, D1 requires an explicit slice operator to convert from a static-array
to a slice/dynamic-array, so I tried this:
ubyte[] =
Nick Sabalausky:
In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] = cast(ubyte[4])num;
How do I do that in D1?
Using a union is probably the safest way:
union Uint2Ubyte {
uint u;
ubyte[4] b;
}
By the way, this of type
Nick Sabalausky:
In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] = cast(ubyte[4])num;
How do I do that in D1?
Using a union is probably the safest way:
union Uint2Ubyte {
uint u;
ubyte[4] b;
}
By the way, this of type
On Thu, 02 Jun 2011 05:35:40 -0400, Nick Sabalausky a@a.a wrote:
In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] = cast(ubyte[4])num;
How do I do that in D1?
IIRC, D1 requires an explicit slice operator to convert from a
static-array
Timon Gehr timon.g...@gmx.ch wrote in message
news:is7ojo$2ggv$1...@digitalmars.com...
Nick Sabalausky:
In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] = cast(ubyte[4])num;
How do I do that in D1?
Using a union is probably the safest
Nick Sabalausky a@a.a wrote in message
news:is8qu8$1cq3$1...@digitalmars.com...
Timon Gehr timon.g...@gmx.ch wrote in message
news:is7ojo$2ggv$1...@digitalmars.com...
Nick Sabalausky:
In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] =