(Variables) |
A : BITMAP ARRAY |
sA: Size of bitmap data type |
(eg., unsigned char ABITMAP_ARRAY_SIZE, |
in that case we have sA = 8) |
index: indicator of array index |
position: bit position in a A, |
where = 0, 1, 2,…, BITMAP_ARRAY_SIZE |
LAB (A) |
(1) index ← 0 |
(2) for i ← 0 to BIITMAP_ARRAY_SIZE |
(3) for j ← 0 to sA – 1 |
(4) if (A & (0 × 01 << ) == 0 |
(5) SD_index ← + (sA * i) |
(6) return SD_index |
(7) |
(8) |
(9) return NO_AVAILABLE_SD |
MAB (A) |
(1) index ← (BITMAP_ARRAY_SIZE − 1)/sA |
(2) position ← (BITMAP_ARRAY_SIZE − 1) mod sA |
(3) if (Aindex & (0 × 01 << position) == 1 |
(4) return NO_AVAILABLE_SD |
(5) for ← index to 0 |
(6) for ← 0 to sA − 1 |
(7) if (A & ((0 × 01 << sA − 1) >> ) == 0 |
(8) SD_index ← sA − + (j * sA) |
(9) return SD_index |
(10) |
(11) |
(12) return NO_AVAILABLE_SD |
RAND_SD (A) |
(1) do |
(2) r_sd ← random(1.MAX_SD) |
(3) index ← r_sd/sA |
(4) position ← r_sd mod sA |
(5) while (Aindex & (0 × 01 << position)) == 1 |
(6) SD_index ← position + index * sA |
(7) return SD_index |