Matthew Watson wrote: | The "endian-ness" of the platform should be hidden by .Net, so as far as I know the simple solution using shifts should work...
|
|
At first I thought that you were wrong, but then I saw the err of my thinking. Their memory footprints are different, but the actual operation is math based, and is done in registers, and the storage mechanism doesnt affect the process at all as we are not operating over memory locations as we used to ages ago. So yes, I stand corrected, the below formula will work on both systems (cast is still needed to prevent negative i1 from messing up the result)
long l2 = (long)((ulong)i1 << 32 | i2);
That being said, what little-endian systems support .NET I havent heard of any yet...
|