Lines Matching +full:32 +full:- +full:bits

4  * Copyright (C) 1996-1997  Paul H. Hargrove
11 * search/set/clear bits.
20 * Given a block of memory, its length in bits, and a starting bit number,
21 * determine the number of the first zero bits (in left-to-right ordering)
24 * Returns >= 'size' if no zero bits are found in the range.
26 * Accesses memory in 32-bit aligned chunks of 32-bits and thus
40 curr = bitmap + (offset / 32); in hfs_find_set_zero_bits()
41 end = bitmap + ((size + 31) / 32); in hfs_find_set_zero_bits()
43 /* scan the first partial u32 for zero bits */ in hfs_find_set_zero_bits()
47 i = offset % 32; in hfs_find_set_zero_bits()
49 for (; i < 32; mask >>= 1, i++) { in hfs_find_set_zero_bits()
61 for (i = 0; i < 32; mask >>= 1, i++) { in hfs_find_set_zero_bits()
70 start = (curr - bitmap) * 32 + i; in hfs_find_set_zero_bits()
74 len = min(size - start, len); in hfs_find_set_zero_bits()
77 if (++i >= 32) in hfs_find_set_zero_bits()
80 if (!--len || n & mask) in hfs_find_set_zero_bits()
83 if (!--len) in hfs_find_set_zero_bits()
89 if (len < 32) in hfs_find_set_zero_bits()
92 len = 32; in hfs_find_set_zero_bits()
96 len -= 32; in hfs_find_set_zero_bits()
108 *max = (curr - bitmap) * 32 + i - start; in hfs_find_set_zero_bits()
116 * Search for 'num_bits' consecutive cleared bits in the bitmap blocks of
123 * u16 *num_bits: Pointer to the number of cleared bits
126 * u16 *num_bits: The number of consecutive clear bits of the
130 * The number of the first bit of the range of cleared bits which has been
135 * the number of cleared bits to find.
148 mutex_lock(&HFS_SB(sb)->bitmap_lock); in hfs_vbm_search_free()
149 bitmap = HFS_SB(sb)->bitmap; in hfs_vbm_search_free()
151 pos = hfs_find_set_zero_bits(bitmap, HFS_SB(sb)->fs_ablocks, goal, num_bits); in hfs_vbm_search_free()
152 if (pos >= HFS_SB(sb)->fs_ablocks) { in hfs_vbm_search_free()
155 if (pos >= HFS_SB(sb)->fs_ablocks) { in hfs_vbm_search_free()
162 HFS_SB(sb)->free_ablocks -= *num_bits; in hfs_vbm_search_free()
165 mutex_unlock(&HFS_SB(sb)->bitmap_lock); in hfs_vbm_search_free()
174 * Clear the requested bits in the volume bitmap of the hfs filesystem
178 * u16 count: The number of bits
183 * -1: One of the bits was already clear. This is a strange
185 * -2: One or more of the bits are out of range of the bitmap.
189 * Starting with bit number 'start', 'count' bits in the volume bitmap
204 /* are all of the bits in range? */ in hfs_clear_vbm_bits()
205 if ((start + count) > HFS_SB(sb)->fs_ablocks) in hfs_clear_vbm_bits()
206 return -2; in hfs_clear_vbm_bits()
208 mutex_lock(&HFS_SB(sb)->bitmap_lock); in hfs_clear_vbm_bits()
209 /* bitmap is always on a 32-bit boundary */ in hfs_clear_vbm_bits()
210 curr = HFS_SB(sb)->bitmap + (start / 32); in hfs_clear_vbm_bits()
214 i = start % 32; in hfs_clear_vbm_bits()
216 int j = 32 - i; in hfs_clear_vbm_bits()
224 count -= j; in hfs_clear_vbm_bits()
228 while (count >= 32) { in hfs_clear_vbm_bits()
230 count -= 32; in hfs_clear_vbm_bits()
238 HFS_SB(sb)->free_ablocks += len; in hfs_clear_vbm_bits()
239 mutex_unlock(&HFS_SB(sb)->bitmap_lock); in hfs_clear_vbm_bits()