求大神解释下这段程序

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条回答
dirtwillfly
1楼-- · 2019-07-25 15:24
从哪里复制来的?
FireRiver9
2楼-- · 2019-07-25 17:42
检查是否已设置了相应的位节点,检查指定的节点是否已在队列中,
是返回 TRUE
xyz549040622
3楼-- · 2019-07-25 17:46
FireRiver9 发表于 2015-10-19 21:40
检查是否已设置了相应的位节点,检查指定的节点是否已在队列中,
是返回 TRUE ...

这都可以看懂,佩服!
FireRiver9
4楼-- · 2019-07-25 17:55
 精彩回答 2  元偷偷看……
wgwgnuaaseu
5楼-- · 2019-07-25 22:05
FireRiver9 发表于 2015-10-24 17:18
呵呵,我是看的上面的英文注解,也不知道说的对不对

这个我当然知道,只是为什么这样写就能实现判断节点是否在?
dirtwillfly
6楼-- · 2019-07-25 22:22
wgwgnuaaseu 发表于 2015-10-27 10:08
这个我当然知道,只是为什么这样写就能实现判断节点是否在?

这个要结合你的整个工程来看,但看这几句是看不出来为啥这样写的

一周热门 更多>