亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
下面這段代碼看不懂
[打印本頁]
作者:
yizhengming
時(shí)間:
2013-08-11 19:49
標(biāo)題:
下面這段代碼看不懂
本帖最后由 yizhengming 于 2013-08-11 19:50 編輯
求高人解釋下面這段代碼
#define BITS_PER_LONG 32
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG))
276 void bitmap_set(unsigned long *map, int start, int nr)
277 {
278 unsigned long *p = map + BIT_WORD(start);
279 const int size = start + nr;
280 int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
281 unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
282
283 while (nr - bits_to_set >= 0) {
284 *p |= mask_to_set;
285 nr -= bits_to_set;
286 bits_to_set = BITS_PER_LONG;
287 mask_to_set = ~0UL;
288 p++;
289 }
290 if (nr) {
291 mask_to_set &= BITMAP_LAST_WORD_MASK(size);
292 *p |= mask_to_set;
293 }
294 }
作者:
linux_c_py_php
時(shí)間:
2013-08-11 19:53
就是個(gè)數(shù)組, 作為一個(gè)位圖用, 設(shè)置第幾位-第幾位為1 or 0
C語言位運(yùn)算搞清楚沒什么難度.
作者:
yizhengming
時(shí)間:
2013-08-11 20:29
回復(fù)
2#
linux_c_py_php
懂了 慚愧 確實(shí)很簡(jiǎn)單 謝謝了
歡迎光臨 Chinaunix (http://www.72891.cn/)
Powered by Discuz! X3.2