?????????????????????????????
???????????? ???????[ 2012/10/8 9:58:38 ] ????????
?????????????е???????????????????????ж??????????????????????????????????ɡ???????????????????????????????????????????????????????????????????????Щ??????????ж????????????????????????????????????????????????????????????????????????bitmap?????????????????????????????bit_search_first_one?????????????????bitmap???飬????????????????????????????????????μ?????????????????????????????????????????????
/*For 32 bit cpu*/ RAW_S32 bit_search_first_one(RAW_U32 *base?? RAW_S32 offset?? RAW_S32 width) { register RAW_U32 *cp?? v; register RAW_S32 position; cp = base; cp += offset >> 5; if (offset & 31) { #if (CONFIG_RAW_LITTLE_ENDIAN > 0) v = *cp & ~(((RAW_U32)1 << (offset & 31)) - 1); #else v = *cp & (((RAW_U32)1 << (32 - (offset & 31))) - 1); #endif } else { v = *cp; } position = 0; while (position < width) { if (v) { /* includes 1 --> search bit of 1 */ if (!position) position -= (offset & 31); #if (CONFIG_RAW_LITTLE_ENDIAN > 0) if (!(v & 0xffff)) { v >>= 16; position += 16; } if (!(v & 0xff)) { v >>= 8; position += 8; } if (!(v & 0xf)) { v >>= 4; position += 4; } if (!(v & 0x3)) { v >>= 2; position += 2; } if (!(v & 0x1)) { ++position; } #else if (!(v & 0xffff0000)) { v <<= 16; position += 16; } if (!(v & 0xff000000)) { v <<= 8; position += 8; } if (!(v & 0xf0000000)) { v <<= 4; position += 4; } if (!(v & 0xc0000000)) { v <<= 2; position += 2; } if (!(v & 0x80000000)) { ++position; } #endif if (position < width) { return position; } else { return -1; } } else { /* all bits are 0 --> 1 Word skip */ if (position) { position += 32; } else { position = 32 - (offset & 31); } v = *++cp; } } return -1; } |
???????????????????????????????32λcpu??????????8λcpu????????????????????????????????Σ?????????????????С????????С????x86????cpu???????powerpc????cpu?????????????????????????????????????????????????????ucos?????????????????????????????????????豸???????????????????????治????????????????????д???????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11