private static bool _isBigEndian;
private static bool _isEndianChecked = false;
private static bool IsBigEndian()
{
if( !_isEndianChecked )
{
_isEndianChecked = true;
int nCheck = 0x01aa;
_isBigEndian = ( nCheck & 0xff ) == 0x01;
}
return _isBigEndian;
}
private static int SwitchEndianInt( int inNum )
{
int nRet = ( inNum & 0xff ) << 24 |
( inNum & 0xff00 ) << 8 |
( inNum >> 8 ) & 0xff00 |
( inNum >> 24 ) & 0xff;
return nRet;
}
C#判断大小端并转换int数据
最新推荐文章于 2024-08-15 15:55:16 发布