散分 ,今晚结贴,关于数据类型转换

CCKITTY 2005-12-04 08:28:03
(C#) 数据类型转换. 填充下列函数体
// typedef struct
// {
// UINT16 day :5; // years since 1904 (MAC format)
// UINT16 month :4;
// UINT16 year :7;
// } DateType;
//
// Sample; byte[] = 0x90CA -> UInt16 = 0xCA90 -> 1100101 0100 10000 year = 101 month = 4 day =16
// year = 101 + 1904 = 2005

/// <summary>
/// DateType 转换成 代表year month day 的整形数组, 即是分离年,月,日字段
/// </summary>
/// <param name="byteDateType"></param>
/// <returns></returns>
public static int[] DateTypeToDate (byte[] byteDateType)
{
// 答案:
}
...全文
105 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
runrunrun 2005-12-04
  • 打赏
  • 举报
回复
int[] xx = new int[3];

xx[0] = (byteDateType[1]>>1) + 1904;
xx[1] = (byteDateType[1] & 1) | ( byteDateType[0] >> 5 );
xx[2] = byteDateType[0] & 0x1F;

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧