Changeset f72906c in mainline for kernel/generic/src/adt/bitmap.c
- Timestamp:
- 2013-09-12T18:09:51Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 69f5f19
- Parents:
- b11f6fb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/adt/bitmap.c
rb11f6fb rf72906c 258 258 * @param count Number of continuous zero bits to find. 259 259 * @param base Address of the first bit in the bitmap. 260 * @param prefered Prefered address to start searching from. 260 261 * @param constraint Constraint for the address of the first zero bit. 261 262 * @param index Place to store the index of the first zero … … 269 270 */ 270 271 int bitmap_allocate_range(bitmap_t *bitmap, size_t count, size_t base, 271 size_t constraint, size_t *index)272 size_t prefered, size_t constraint, size_t *index) 272 273 { 273 274 if (count == 0) … … 275 276 276 277 size_t size = bitmap_size(bitmap->elements); 278 size_t next_fit = bitmap->next_fit; 279 280 /* 281 * Adjust the next-fit value according to the address 282 * the caller prefers to start the search at. 283 */ 284 if ((prefered > base) && (prefered < base + bitmap->elements)) { 285 size_t prefered_fit = (prefered - base) / BITMAP_ELEMENT; 286 287 if (prefered_fit > next_fit) 288 next_fit = prefered_fit; 289 } 277 290 278 291 for (size_t pos = 0; pos < size; pos++) { 279 size_t byte = ( bitmap->next_fit + pos) % size;292 size_t byte = (next_fit + pos) % size; 280 293 281 294 /* Skip if the current byte has all bits set */
Note:
See TracChangeset
for help on using the changeset viewer.