赞
踩
private int Int24ToInt32_1(byte b1, byte b2, byte b3)
{
uint uintTemp = (uint)(b1 * 0x1000000 + b2 * 0x10000 + b3 * 0x100);
int intTemp = (int)uintTemp;
return intTemp / 256;
}
private int Int24ToInt32_2(byte b1, byte b2, byte b3)
{
uint uintTemp = (uint)(b1 * 0x10000 + b2 * 0x100 + b3);
if (b1 > 0x7f)
{
uintTemp += 0xff000000;
}
return (int)uintTemp;
}
private int Int24ToInt32_3(byte b1, byte b2, byte b3)
{
byte[] b = { 0, b3, b2, b1 };
return BitConverter.ToInt32(b, 0) / 0x100;
}
private int Int24ToInt32_4(byte b1, byte b2, byte b3)
{
byte[] b = { b3, b2, b1, 0 };
uint uintTemp = BitConverter.ToUInt32(b, 0);
if (b1 > 0x7f)
{
uintTemp += 0xff000000;
}
return (int)uintTemp;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。