Subversion Repositories HelenOS

Rev

Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4537
Line 52... Line 52...
52
 *
52
 *
53
 * @param bitmap Bitmap structure.
53
 * @param bitmap Bitmap structure.
54
 * @param map Address of the memory used to hold the map.
54
 * @param map Address of the memory used to hold the map.
55
 * @param bits Number of bits stored in bitmap.
55
 * @param bits Number of bits stored in bitmap.
56
 */
56
 */
57
void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, count_t bits)
57
void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits)
58
{
58
{
59
    bitmap->map = map;
59
    bitmap->map = map;
60
    bitmap->bits = bits;
60
    bitmap->bits = bits;
61
}
61
}
62
 
62
 
Line 64... Line 64...
64
 *
64
 *
65
 * @param bitmap Bitmap structure.
65
 * @param bitmap Bitmap structure.
66
 * @param start Starting bit.
66
 * @param start Starting bit.
67
 * @param bits Number of bits to set.
67
 * @param bits Number of bits to set.
68
 */
68
 */
69
void bitmap_set_range(bitmap_t *bitmap, index_t start, count_t bits)
69
void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits)
70
{
70
{
71
    index_t i=0;
71
    size_t i = 0;
72
    index_t aligned_start;
72
    size_t aligned_start;
73
    count_t lub;        /* leading unaligned bits */
73
    size_t lub;     /* leading unaligned bits */
74
    count_t amb;        /* aligned middle bits */
74
    size_t amb;     /* aligned middle bits */
75
    count_t tab;        /* trailing aligned bits */
75
    size_t tab;     /* trailing aligned bits */
76
   
76
   
77
    ASSERT(start + bits <= bitmap->bits);
77
    ASSERT(start + bits <= bitmap->bits);
78
   
78
   
79
    aligned_start = ALIGN_UP(start, 8);
79
    aligned_start = ALIGN_UP(start, 8);
80
    lub = min(aligned_start - start, bits);
80
    lub = min(aligned_start - start, bits);
Line 114... Line 114...
114
 *
114
 *
115
 * @param bitmap Bitmap structure.
115
 * @param bitmap Bitmap structure.
116
 * @param start Starting bit.
116
 * @param start Starting bit.
117
 * @param bits Number of bits to clear.
117
 * @param bits Number of bits to clear.
118
 */
118
 */
119
void bitmap_clear_range(bitmap_t *bitmap, index_t start, count_t bits)
119
void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits)
120
{
120
{
121
    index_t i=0;
121
    size_t i = 0;
122
    index_t aligned_start;
122
    size_t aligned_start;
123
    count_t lub;        /* leading unaligned bits */
123
    size_t lub;     /* leading unaligned bits */
124
    count_t amb;        /* aligned middle bits */
124
    size_t amb;     /* aligned middle bits */
125
    count_t tab;        /* trailing aligned bits */
125
    size_t tab;     /* trailing aligned bits */
126
   
126
   
127
    ASSERT(start + bits <= bitmap->bits);
127
    ASSERT(start + bits <= bitmap->bits);
128
   
128
   
129
    aligned_start = ALIGN_UP(start, 8);
129
    aligned_start = ALIGN_UP(start, 8);
130
    lub = min(aligned_start - start, bits);
130
    lub = min(aligned_start - start, bits);
Line 166... Line 166...
166
 *
166
 *
167
 * @param dst Destination bitmap.
167
 * @param dst Destination bitmap.
168
 * @param src Source bitmap.
168
 * @param src Source bitmap.
169
 * @param bits Number of bits to copy.
169
 * @param bits Number of bits to copy.
170
 */
170
 */
171
void bitmap_copy(bitmap_t *dst, bitmap_t *src, count_t bits)
171
void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits)
172
{
172
{
173
    index_t i;
173
    size_t i;
174
   
174
   
175
    ASSERT(bits <= dst->bits);
175
    ASSERT(bits <= dst->bits);
176
    ASSERT(bits <= src->bits);
176
    ASSERT(bits <= src->bits);
177
   
177
   
178
    for (i = 0; i < bits / 8; i++)
178
    for (i = 0; i < bits / 8; i++)