求大神解释下这段程序

2019-07-25 14:47发布

////////////////////////////////////////////////////////////////////////////////////////////////////
// FUNCT:
//  Mesh_Checkqueue
// DESCR:
//  Check if the corresponding bit of wanted node has been set or not.
//  Check whether specified node is already in the queue.
//  If set, return 1. Else return 0.
// INPUTS:
//  node - node ID.
//  parray - indication array
// OUTPUTS:
//  node  - ID of the node.
// RETURN:
//  TRUE or FALSE indicate whether specified node is in the queue.
// Considerations:
//  None.
////////////////////////////////////////////////////////////////////////////////////////////////////
uint8 Mesh_Checkqueue(address_size node, const uint8* parray)
{
address_size i;
address_size j;
address_size k;
node --;    // node - 1 to align with the corresponding bit in the array
i = node / 8;
j = node % 8;
k = 0x01 << j;
if((parray[i] & k) != 0)
{
  return TRUE;
}
else
  return FALSE;
}

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
9条回答
xiaoyaozt
1楼-- · 2019-07-26 03:08
c++?
蔚蓝的海
2楼-- · 2019-07-26 08:14
wgwgnuaaseu 发表于 2015-10-27 10:08
这个我当然知道,只是为什么这样写就能实现判断节点是否在?

光看这一段,什么也看不出来哇。
Thefantasy
3楼-- · 2019-07-26 13:24
 精彩回答 2  元偷偷看……

一周热门 更多>