1Testing with TEST_LENGTH = 27 2 3test _bit_byte, _bit_mask, and bitstr_size 4 i _bit_byte(i) _bit_mask(i) bitstr_size(i) 5 0 0 1 0 6 1 0 2 1 7 2 0 4 1 8 3 0 8 1 9 4 0 16 1 10 5 0 32 1 11 6 0 64 1 12 7 0 128 1 13 8 1 1 1 14 9 1 2 2 15 10 1 4 2 16 11 1 8 2 17 12 1 16 2 18 13 1 32 2 19 14 1 64 2 20 15 1 128 2 21 16 2 1 2 22 17 2 2 3 23 18 2 4 3 24 19 2 8 3 25 20 2 16 3 26 21 2 32 3 27 22 2 64 3 28 23 2 128 3 29 24 3 1 3 30 25 3 2 4 31 26 3 4 4 32 33test bit_alloc, clearbits, bit_ffc, bit_ffs 34be: 0 -1 000000000000000000000000000 35is: 0 -1 000000000000000000000000000 36 37test bit_set 38be: 1 0 100100100100100100100100100 39is: 1 0 100100100100100100100100100 40 41test bit_clear 42be: 0 3 000100000100000100000100000 43is: 0 3 000100000100000100000100000 44 45test bit_test using previous bitstring 46 i bit_test(i) 47 0 0 48 1 0 49 2 0 50 3 8 51 4 0 52 5 0 53 6 0 54 7 0 55 8 0 56 9 2 57 10 0 58 11 0 59 12 0 60 13 0 61 14 0 62 15 128 63 16 0 64 17 0 65 18 0 66 19 0 67 20 0 68 21 32 69 22 0 70 23 0 71 24 0 72 25 0 73 26 0 74 75test clearbits 76be: 0 -1 000000000000000000000000000 77is: 0 -1 000000000000000000000000000 78 79test bit_nset and bit_nclear 80be: 0 1 011111111111111111111111110 81is: 0 1 011111111111111111111111110 82be: 0 1 010000000000000000000000010 83is: 0 1 010000000000000000000000010 84be: 0 -1 000000000000000000000000000 85is: 0 -1 000000000000000000000000000 86be: 26 0 111111111111111111111111110 87is: 26 0 111111111111111111111111110 88be: 0 -1 000000000000000000000000000 89is: 0 -1 000000000000000000000000000 90 91first 1 bit should move right 1 position each line 92 0 -1 0 111111111111111111111111111 93 1 0 1 011111111111111111111111111 94 2 0 2 001111111111111111111111111 95 3 0 3 000111111111111111111111111 96 4 0 4 000011111111111111111111111 97 5 0 5 000001111111111111111111111 98 6 0 6 000000111111111111111111111 99 7 0 7 000000011111111111111111111 100 8 0 8 000000001111111111111111111 101 9 0 9 000000000111111111111111111 102 10 0 10 000000000011111111111111111 103 11 0 11 000000000001111111111111111 104 12 0 12 000000000000111111111111111 105 13 0 13 000000000000011111111111111 106 14 0 14 000000000000001111111111111 107 15 0 15 000000000000000111111111111 108 16 0 16 000000000000000011111111111 109 17 0 17 000000000000000001111111111 110 18 0 18 000000000000000000111111111 111 19 0 19 000000000000000000011111111 112 20 0 20 000000000000000000001111111 113 21 0 21 000000000000000000000111111 114 22 0 22 000000000000000000000011111 115 23 0 23 000000000000000000000001111 116 24 0 24 000000000000000000000000111 117 25 0 25 000000000000000000000000011 118 26 0 26 000000000000000000000000001 119 120first 0 bit should move right 1 position each line 121 0 0 -1 000000000000000000000000000 122 1 1 0 100000000000000000000000000 123 2 2 0 110000000000000000000000000 124 3 3 0 111000000000000000000000000 125 4 4 0 111100000000000000000000000 126 5 5 0 111110000000000000000000000 127 6 6 0 111111000000000000000000000 128 7 7 0 111111100000000000000000000 129 8 8 0 111111110000000000000000000 130 9 9 0 111111111000000000000000000 131 10 10 0 111111111100000000000000000 132 11 11 0 111111111110000000000000000 133 12 12 0 111111111111000000000000000 134 13 13 0 111111111111100000000000000 135 14 14 0 111111111111110000000000000 136 15 15 0 111111111111111000000000000 137 16 16 0 111111111111111100000000000 138 17 17 0 111111111111111110000000000 139 18 18 0 111111111111111111000000000 140 19 19 0 111111111111111111100000000 141 20 20 0 111111111111111111110000000 142 21 21 0 111111111111111111111000000 143 22 22 0 111111111111111111111100000 144 23 23 0 111111111111111111111110000 145 24 24 0 111111111111111111111111000 146 25 25 0 111111111111111111111111100 147 26 26 0 111111111111111111111111110 148 149first 0 bit should move left 1 position each line 150 0 -1 0 111111111111111111111111111 151 1 26 0 111111111111111111111111110 152 2 25 0 111111111111111111111111100 153 3 24 0 111111111111111111111111000 154 4 23 0 111111111111111111111110000 155 5 22 0 111111111111111111111100000 156 6 21 0 111111111111111111111000000 157 7 20 0 111111111111111111110000000 158 8 19 0 111111111111111111100000000 159 9 18 0 111111111111111111000000000 160 10 17 0 111111111111111110000000000 161 11 16 0 111111111111111100000000000 162 12 15 0 111111111111111000000000000 163 13 14 0 111111111111110000000000000 164 14 13 0 111111111111100000000000000 165 15 12 0 111111111111000000000000000 166 16 11 0 111111111110000000000000000 167 17 10 0 111111111100000000000000000 168 18 9 0 111111111000000000000000000 169 19 8 0 111111110000000000000000000 170 20 7 0 111111100000000000000000000 171 21 6 0 111111000000000000000000000 172 22 5 0 111110000000000000000000000 173 23 4 0 111100000000000000000000000 174 24 3 0 111000000000000000000000000 175 25 2 0 110000000000000000000000000 176 26 1 0 100000000000000000000000000 177 178first 1 bit should move left 1 position each line 179 0 0 -1 000000000000000000000000000 180 1 0 26 000000000000000000000000001 181 2 0 25 000000000000000000000000011 182 3 0 24 000000000000000000000000111 183 4 0 23 000000000000000000000001111 184 5 0 22 000000000000000000000011111 185 6 0 21 000000000000000000000111111 186 7 0 20 000000000000000000001111111 187 8 0 19 000000000000000000011111111 188 9 0 18 000000000000000000111111111 189 10 0 17 000000000000000001111111111 190 11 0 16 000000000000000011111111111 191 12 0 15 000000000000000111111111111 192 13 0 14 000000000000001111111111111 193 14 0 13 000000000000011111111111111 194 15 0 12 000000000000111111111111111 195 16 0 11 000000000001111111111111111 196 17 0 10 000000000011111111111111111 197 18 0 9 000000000111111111111111111 198 19 0 8 000000001111111111111111111 199 20 0 7 000000011111111111111111111 200 21 0 6 000000111111111111111111111 201 22 0 5 000001111111111111111111111 202 23 0 4 000011111111111111111111111 203 24 0 3 000111111111111111111111111 204 25 0 2 001111111111111111111111111 205 26 0 1 011111111111111111111111111 206 2070 bit should move right 1 position each line 208 0 0 1 011111111111111111111111111 209 1 1 0 101111111111111111111111111 210 2 2 0 110111111111111111111111111 211 3 3 0 111011111111111111111111111 212 4 4 0 111101111111111111111111111 213 5 5 0 111110111111111111111111111 214 6 6 0 111111011111111111111111111 215 7 7 0 111111101111111111111111111 216 8 8 0 111111110111111111111111111 217 9 9 0 111111111011111111111111111 218 10 10 0 111111111101111111111111111 219 11 11 0 111111111110111111111111111 220 12 12 0 111111111111011111111111111 221 13 13 0 111111111111101111111111111 222 14 14 0 111111111111110111111111111 223 15 15 0 111111111111111011111111111 224 16 16 0 111111111111111101111111111 225 17 17 0 111111111111111110111111111 226 18 18 0 111111111111111111011111111 227 19 19 0 111111111111111111101111111 228 20 20 0 111111111111111111110111111 229 21 21 0 111111111111111111111011111 230 22 22 0 111111111111111111111101111 231 23 23 0 111111111111111111111110111 232 24 24 0 111111111111111111111111011 233 25 25 0 111111111111111111111111101 234 26 26 0 111111111111111111111111110 235 2361 bit should move right 1 position each line 237 0 1 0 100000000000000000000000000 238 1 0 1 010000000000000000000000000 239 2 0 2 001000000000000000000000000 240 3 0 3 000100000000000000000000000 241 4 0 4 000010000000000000000000000 242 5 0 5 000001000000000000000000000 243 6 0 6 000000100000000000000000000 244 7 0 7 000000010000000000000000000 245 8 0 8 000000001000000000000000000 246 9 0 9 000000000100000000000000000 247 10 0 10 000000000010000000000000000 248 11 0 11 000000000001000000000000000 249 12 0 12 000000000000100000000000000 250 13 0 13 000000000000010000000000000 251 14 0 14 000000000000001000000000000 252 15 0 15 000000000000000100000000000 253 16 0 16 000000000000000010000000000 254 17 0 17 000000000000000001000000000 255 18 0 18 000000000000000000100000000 256 19 0 19 000000000000000000010000000 257 20 0 20 000000000000000000001000000 258 21 0 21 000000000000000000000100000 259 22 0 22 000000000000000000000010000 260 23 0 23 000000000000000000000001000 261 24 0 24 000000000000000000000000100 262 25 0 25 000000000000000000000000010 263 26 0 26 000000000000000000000000001 264