标签:
public static long ushortTolong(ushort pre48, ushort pre32, ushort pre16, ushort pre0) { ulong rt = 0; ulong temp = 0; temp = pre48; rt = temp << 48; temp = pre32; temp = temp << 32; rt = rt | temp; temp = pre16; temp = temp << 16; rt = rt | temp; temp = pre0; rt = rt | temp; return (long)(rt >> 1); } public static int ushortToint(ushort pre16, ushort pre0) { uint rt = 0; uint temp = 0; temp = pre16; temp = temp << 16; rt = rt | temp; temp = pre0; rt = rt | temp; return (int)(rt >> 1); }
位运算实现ushort(16位)转化成long(64位)以及int(32位)
标签:
原文地址:http://www.cnblogs.com/ttWorld/p/4479744.html