利用64位数 存储32个标志 加两个数据
学习
2024-03-31 17:08
267
0
1 /// <summary>
2 /// 前32位 功能 0-31 取第几位
3 /// </summary>
4 /// <param name="_Resource"></param>
5 /// <param name="_Mask"></param>
6 /// <returns></returns>
7 public static long GetSomeBit(long _Resource, int _Mask)
8 {
9 return _Resource >> _Mask & 1;
10 }
11 /// <summary>
12 /// 取拆分后32位的 高16位值
13 /// </summary>
14 /// <param name="_Resource"></param>
15 /// <returns></returns>
16 public static ulong GetHigt16Bit(ulong _Resource)
17 {
18 //CP1 = (CurrentPosition & 0xff000000UL) >> 24;
19 //CP2 = (CurrentPosition & 0x00ff0000UL) >> 16;
20 //CP3 = (CurrentPosition & 0x0000ff00UL) >> 8;
21 //CP4 = (CurrentPosition & 0x000000ffUL) ;
22
23 return (_Resource & 0xffff000000000000UL) >> 48;
24 }
25 /// <summary>
26 /// 取拆分后32位的 低16位 Z坐标绝对值
27 /// </summary>
28 /// <param name="_Resource"></param>
29 /// <returns></returns>
30 public static ulong GetLow16Bit(ulong _Resource)
31 {
32 return (_Resource & 0x0000ffff00000000UL) >> 32;
33 }