data mapping, more elegant solution?

mandel oh at no.es
Thu Dec 13 05:20:51 PST 2007


Hi,

I want to map a uint to a position of an ubyte array.
Atm. I use this:

ubyte[8] array;
*cast(uint*) &array.ptr[0] = 42;

But is there a nicer solution to do achive this?

Smth. like  "array[0..4] = 42;", but this tries to assign 42 to every 
byte (resulting in [0x2a, 0x2a, 0x2a, 0x2a, 0x00, 0x00, 0x00, 0x00]).


More information about the Digitalmars-d-learn mailing list