Casting byte[] to int/long
Henrik
zodiachus at gmail.com
Wed Nov 29 09:48:59 PST 2006
Hello!
If I have a dynamic array of bytes, say
byte[] a; a = [1,2,3,4];
Is it possible to somehow cast a number of these bytes into an int or a long,
like so;
int b = cast(int)a[0..2];
long c = cast(long)a;
or something? The goal is to convert 2 * 8 bit into 1 * 16 bit or 4 * 8 bit
into 1 * 64 bit. 1) Is it possible? 2) Is it possible without confusing the
GC? 3) How? ;)
More information about the Digitalmars-d
mailing list