G
Guest
Hi,
as someone pulling to C# over from C++ I stumbled over something today for
which I was not able to find an answer:
HOW do I convert a byte block with a given endianess to an int32 and vice
versa?
In C++ I have this:
#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)
*myword = _byteswap_ulong(mybigendianword);
which results in a wonderful single assembler instruction.
The only documentation I found about endianess is on handling UTF8/16
strings, but not with binary stuff.
Can someone give me a hint how I perform such things FAST and not via my own
clumsy version?
thanks
doc
as someone pulling to C# over from C++ I stumbled over something today for
which I was not able to find an answer:
HOW do I convert a byte block with a given endianess to an int32 and vice
versa?
In C++ I have this:
#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)
*myword = _byteswap_ulong(mybigendianword);
which results in a wonderful single assembler instruction.
The only documentation I found about endianess is on handling UTF8/16
strings, but not with binary stuff.
Can someone give me a hint how I perform such things FAST and not via my own
clumsy version?
thanks
doc