1Testing with TEST_LENGTH = 49 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 27 3 8 4 33 28 3 16 4 34 29 3 32 4 35 30 3 64 4 36 31 3 128 4 37 32 4 1 4 38 33 4 2 5 39 34 4 4 5 40 35 4 8 5 41 36 4 16 5 42 37 4 32 5 43 38 4 64 5 44 39 4 128 5 45 40 5 1 5 46 41 5 2 6 47 42 5 4 6 48 43 5 8 6 49 44 5 16 6 50 45 5 32 6 51 46 5 64 6 52 47 5 128 6 53 48 6 1 6 54 55test bit_alloc, clearbits, bit_ffc, bit_ffs 56be: 0 -1 0000000000000000000000000000000000000000000000000 57is: 0 -1 0000000000000000000000000000000000000000000000000 58 59test bit_set 60be: 1 0 1001001001001001001001001001001001001001001001001 61is: 1 0 1001001001001001001001001001001001001001001001001 62 63test bit_clear 64be: 0 3 0001000001000001000001000001000001000001000001000 65is: 0 3 0001000001000001000001000001000001000001000001000 66 67test bit_test using previous bitstring 68 i bit_test(i) 69 0 0 70 1 0 71 2 0 72 3 8 73 4 0 74 5 0 75 6 0 76 7 0 77 8 0 78 9 2 79 10 0 80 11 0 81 12 0 82 13 0 83 14 0 84 15 128 85 16 0 86 17 0 87 18 0 88 19 0 89 20 0 90 21 32 91 22 0 92 23 0 93 24 0 94 25 0 95 26 0 96 27 8 97 28 0 98 29 0 99 30 0 100 31 0 101 32 0 102 33 2 103 34 0 104 35 0 105 36 0 106 37 0 107 38 0 108 39 128 109 40 0 110 41 0 111 42 0 112 43 0 113 44 0 114 45 32 115 46 0 116 47 0 117 48 0 118 119test clearbits 120be: 0 -1 0000000000000000000000000000000000000000000000000 121is: 0 -1 0000000000000000000000000000000000000000000000000 122 123test bit_nset and bit_nclear 124be: 0 1 0111111111111111111111111111111111111111111111110 125is: 0 1 0111111111111111111111111111111111111111111111110 126be: 0 1 0100000000000000000000000000000000000000000000010 127is: 0 1 0100000000000000000000000000000000000000000000010 128be: 0 -1 0000000000000000000000000000000000000000000000000 129is: 0 -1 0000000000000000000000000000000000000000000000000 130be: 48 0 1111111111111111111111111111111111111111111111110 131is: 48 0 1111111111111111111111111111111111111111111111110 132be: 0 -1 0000000000000000000000000000000000000000000000000 133is: 0 -1 0000000000000000000000000000000000000000000000000 134 135first 1 bit should move right 1 position each line 136 0 -1 0 1111111111111111111111111111111111111111111111111 137 1 0 1 0111111111111111111111111111111111111111111111111 138 2 0 2 0011111111111111111111111111111111111111111111111 139 3 0 3 0001111111111111111111111111111111111111111111111 140 4 0 4 0000111111111111111111111111111111111111111111111 141 5 0 5 0000011111111111111111111111111111111111111111111 142 6 0 6 0000001111111111111111111111111111111111111111111 143 7 0 7 0000000111111111111111111111111111111111111111111 144 8 0 8 0000000011111111111111111111111111111111111111111 145 9 0 9 0000000001111111111111111111111111111111111111111 146 10 0 10 0000000000111111111111111111111111111111111111111 147 11 0 11 0000000000011111111111111111111111111111111111111 148 12 0 12 0000000000001111111111111111111111111111111111111 149 13 0 13 0000000000000111111111111111111111111111111111111 150 14 0 14 0000000000000011111111111111111111111111111111111 151 15 0 15 0000000000000001111111111111111111111111111111111 152 16 0 16 0000000000000000111111111111111111111111111111111 153 17 0 17 0000000000000000011111111111111111111111111111111 154 18 0 18 0000000000000000001111111111111111111111111111111 155 19 0 19 0000000000000000000111111111111111111111111111111 156 20 0 20 0000000000000000000011111111111111111111111111111 157 21 0 21 0000000000000000000001111111111111111111111111111 158 22 0 22 0000000000000000000000111111111111111111111111111 159 23 0 23 0000000000000000000000011111111111111111111111111 160 24 0 24 0000000000000000000000001111111111111111111111111 161 25 0 25 0000000000000000000000000111111111111111111111111 162 26 0 26 0000000000000000000000000011111111111111111111111 163 27 0 27 0000000000000000000000000001111111111111111111111 164 28 0 28 0000000000000000000000000000111111111111111111111 165 29 0 29 0000000000000000000000000000011111111111111111111 166 30 0 30 0000000000000000000000000000001111111111111111111 167 31 0 31 0000000000000000000000000000000111111111111111111 168 32 0 32 0000000000000000000000000000000011111111111111111 169 33 0 33 0000000000000000000000000000000001111111111111111 170 34 0 34 0000000000000000000000000000000000111111111111111 171 35 0 35 0000000000000000000000000000000000011111111111111 172 36 0 36 0000000000000000000000000000000000001111111111111 173 37 0 37 0000000000000000000000000000000000000111111111111 174 38 0 38 0000000000000000000000000000000000000011111111111 175 39 0 39 0000000000000000000000000000000000000001111111111 176 40 0 40 0000000000000000000000000000000000000000111111111 177 41 0 41 0000000000000000000000000000000000000000011111111 178 42 0 42 0000000000000000000000000000000000000000001111111 179 43 0 43 0000000000000000000000000000000000000000000111111 180 44 0 44 0000000000000000000000000000000000000000000011111 181 45 0 45 0000000000000000000000000000000000000000000001111 182 46 0 46 0000000000000000000000000000000000000000000000111 183 47 0 47 0000000000000000000000000000000000000000000000011 184 48 0 48 0000000000000000000000000000000000000000000000001 185 186first 0 bit should move right 1 position each line 187 0 0 -1 0000000000000000000000000000000000000000000000000 188 1 1 0 1000000000000000000000000000000000000000000000000 189 2 2 0 1100000000000000000000000000000000000000000000000 190 3 3 0 1110000000000000000000000000000000000000000000000 191 4 4 0 1111000000000000000000000000000000000000000000000 192 5 5 0 1111100000000000000000000000000000000000000000000 193 6 6 0 1111110000000000000000000000000000000000000000000 194 7 7 0 1111111000000000000000000000000000000000000000000 195 8 8 0 1111111100000000000000000000000000000000000000000 196 9 9 0 1111111110000000000000000000000000000000000000000 197 10 10 0 1111111111000000000000000000000000000000000000000 198 11 11 0 1111111111100000000000000000000000000000000000000 199 12 12 0 1111111111110000000000000000000000000000000000000 200 13 13 0 1111111111111000000000000000000000000000000000000 201 14 14 0 1111111111111100000000000000000000000000000000000 202 15 15 0 1111111111111110000000000000000000000000000000000 203 16 16 0 1111111111111111000000000000000000000000000000000 204 17 17 0 1111111111111111100000000000000000000000000000000 205 18 18 0 1111111111111111110000000000000000000000000000000 206 19 19 0 1111111111111111111000000000000000000000000000000 207 20 20 0 1111111111111111111100000000000000000000000000000 208 21 21 0 1111111111111111111110000000000000000000000000000 209 22 22 0 1111111111111111111111000000000000000000000000000 210 23 23 0 1111111111111111111111100000000000000000000000000 211 24 24 0 1111111111111111111111110000000000000000000000000 212 25 25 0 1111111111111111111111111000000000000000000000000 213 26 26 0 1111111111111111111111111100000000000000000000000 214 27 27 0 1111111111111111111111111110000000000000000000000 215 28 28 0 1111111111111111111111111111000000000000000000000 216 29 29 0 1111111111111111111111111111100000000000000000000 217 30 30 0 1111111111111111111111111111110000000000000000000 218 31 31 0 1111111111111111111111111111111000000000000000000 219 32 32 0 1111111111111111111111111111111100000000000000000 220 33 33 0 1111111111111111111111111111111110000000000000000 221 34 34 0 1111111111111111111111111111111111000000000000000 222 35 35 0 1111111111111111111111111111111111100000000000000 223 36 36 0 1111111111111111111111111111111111110000000000000 224 37 37 0 1111111111111111111111111111111111111000000000000 225 38 38 0 1111111111111111111111111111111111111100000000000 226 39 39 0 1111111111111111111111111111111111111110000000000 227 40 40 0 1111111111111111111111111111111111111111000000000 228 41 41 0 1111111111111111111111111111111111111111100000000 229 42 42 0 1111111111111111111111111111111111111111110000000 230 43 43 0 1111111111111111111111111111111111111111111000000 231 44 44 0 1111111111111111111111111111111111111111111100000 232 45 45 0 1111111111111111111111111111111111111111111110000 233 46 46 0 1111111111111111111111111111111111111111111111000 234 47 47 0 1111111111111111111111111111111111111111111111100 235 48 48 0 1111111111111111111111111111111111111111111111110 236 237first 0 bit should move left 1 position each line 238 0 -1 0 1111111111111111111111111111111111111111111111111 239 1 48 0 1111111111111111111111111111111111111111111111110 240 2 47 0 1111111111111111111111111111111111111111111111100 241 3 46 0 1111111111111111111111111111111111111111111111000 242 4 45 0 1111111111111111111111111111111111111111111110000 243 5 44 0 1111111111111111111111111111111111111111111100000 244 6 43 0 1111111111111111111111111111111111111111111000000 245 7 42 0 1111111111111111111111111111111111111111110000000 246 8 41 0 1111111111111111111111111111111111111111100000000 247 9 40 0 1111111111111111111111111111111111111111000000000 248 10 39 0 1111111111111111111111111111111111111110000000000 249 11 38 0 1111111111111111111111111111111111111100000000000 250 12 37 0 1111111111111111111111111111111111111000000000000 251 13 36 0 1111111111111111111111111111111111110000000000000 252 14 35 0 1111111111111111111111111111111111100000000000000 253 15 34 0 1111111111111111111111111111111111000000000000000 254 16 33 0 1111111111111111111111111111111110000000000000000 255 17 32 0 1111111111111111111111111111111100000000000000000 256 18 31 0 1111111111111111111111111111111000000000000000000 257 19 30 0 1111111111111111111111111111110000000000000000000 258 20 29 0 1111111111111111111111111111100000000000000000000 259 21 28 0 1111111111111111111111111111000000000000000000000 260 22 27 0 1111111111111111111111111110000000000000000000000 261 23 26 0 1111111111111111111111111100000000000000000000000 262 24 25 0 1111111111111111111111111000000000000000000000000 263 25 24 0 1111111111111111111111110000000000000000000000000 264 26 23 0 1111111111111111111111100000000000000000000000000 265 27 22 0 1111111111111111111111000000000000000000000000000 266 28 21 0 1111111111111111111110000000000000000000000000000 267 29 20 0 1111111111111111111100000000000000000000000000000 268 30 19 0 1111111111111111111000000000000000000000000000000 269 31 18 0 1111111111111111110000000000000000000000000000000 270 32 17 0 1111111111111111100000000000000000000000000000000 271 33 16 0 1111111111111111000000000000000000000000000000000 272 34 15 0 1111111111111110000000000000000000000000000000000 273 35 14 0 1111111111111100000000000000000000000000000000000 274 36 13 0 1111111111111000000000000000000000000000000000000 275 37 12 0 1111111111110000000000000000000000000000000000000 276 38 11 0 1111111111100000000000000000000000000000000000000 277 39 10 0 1111111111000000000000000000000000000000000000000 278 40 9 0 1111111110000000000000000000000000000000000000000 279 41 8 0 1111111100000000000000000000000000000000000000000 280 42 7 0 1111111000000000000000000000000000000000000000000 281 43 6 0 1111110000000000000000000000000000000000000000000 282 44 5 0 1111100000000000000000000000000000000000000000000 283 45 4 0 1111000000000000000000000000000000000000000000000 284 46 3 0 1110000000000000000000000000000000000000000000000 285 47 2 0 1100000000000000000000000000000000000000000000000 286 48 1 0 1000000000000000000000000000000000000000000000000 287 288first 1 bit should move left 1 position each line 289 0 0 -1 0000000000000000000000000000000000000000000000000 290 1 0 48 0000000000000000000000000000000000000000000000001 291 2 0 47 0000000000000000000000000000000000000000000000011 292 3 0 46 0000000000000000000000000000000000000000000000111 293 4 0 45 0000000000000000000000000000000000000000000001111 294 5 0 44 0000000000000000000000000000000000000000000011111 295 6 0 43 0000000000000000000000000000000000000000000111111 296 7 0 42 0000000000000000000000000000000000000000001111111 297 8 0 41 0000000000000000000000000000000000000000011111111 298 9 0 40 0000000000000000000000000000000000000000111111111 299 10 0 39 0000000000000000000000000000000000000001111111111 300 11 0 38 0000000000000000000000000000000000000011111111111 301 12 0 37 0000000000000000000000000000000000000111111111111 302 13 0 36 0000000000000000000000000000000000001111111111111 303 14 0 35 0000000000000000000000000000000000011111111111111 304 15 0 34 0000000000000000000000000000000000111111111111111 305 16 0 33 0000000000000000000000000000000001111111111111111 306 17 0 32 0000000000000000000000000000000011111111111111111 307 18 0 31 0000000000000000000000000000000111111111111111111 308 19 0 30 0000000000000000000000000000001111111111111111111 309 20 0 29 0000000000000000000000000000011111111111111111111 310 21 0 28 0000000000000000000000000000111111111111111111111 311 22 0 27 0000000000000000000000000001111111111111111111111 312 23 0 26 0000000000000000000000000011111111111111111111111 313 24 0 25 0000000000000000000000000111111111111111111111111 314 25 0 24 0000000000000000000000001111111111111111111111111 315 26 0 23 0000000000000000000000011111111111111111111111111 316 27 0 22 0000000000000000000000111111111111111111111111111 317 28 0 21 0000000000000000000001111111111111111111111111111 318 29 0 20 0000000000000000000011111111111111111111111111111 319 30 0 19 0000000000000000000111111111111111111111111111111 320 31 0 18 0000000000000000001111111111111111111111111111111 321 32 0 17 0000000000000000011111111111111111111111111111111 322 33 0 16 0000000000000000111111111111111111111111111111111 323 34 0 15 0000000000000001111111111111111111111111111111111 324 35 0 14 0000000000000011111111111111111111111111111111111 325 36 0 13 0000000000000111111111111111111111111111111111111 326 37 0 12 0000000000001111111111111111111111111111111111111 327 38 0 11 0000000000011111111111111111111111111111111111111 328 39 0 10 0000000000111111111111111111111111111111111111111 329 40 0 9 0000000001111111111111111111111111111111111111111 330 41 0 8 0000000011111111111111111111111111111111111111111 331 42 0 7 0000000111111111111111111111111111111111111111111 332 43 0 6 0000001111111111111111111111111111111111111111111 333 44 0 5 0000011111111111111111111111111111111111111111111 334 45 0 4 0000111111111111111111111111111111111111111111111 335 46 0 3 0001111111111111111111111111111111111111111111111 336 47 0 2 0011111111111111111111111111111111111111111111111 337 48 0 1 0111111111111111111111111111111111111111111111111 338 3390 bit should move right 1 position each line 340 0 0 1 0111111111111111111111111111111111111111111111111 341 1 1 0 1011111111111111111111111111111111111111111111111 342 2 2 0 1101111111111111111111111111111111111111111111111 343 3 3 0 1110111111111111111111111111111111111111111111111 344 4 4 0 1111011111111111111111111111111111111111111111111 345 5 5 0 1111101111111111111111111111111111111111111111111 346 6 6 0 1111110111111111111111111111111111111111111111111 347 7 7 0 1111111011111111111111111111111111111111111111111 348 8 8 0 1111111101111111111111111111111111111111111111111 349 9 9 0 1111111110111111111111111111111111111111111111111 350 10 10 0 1111111111011111111111111111111111111111111111111 351 11 11 0 1111111111101111111111111111111111111111111111111 352 12 12 0 1111111111110111111111111111111111111111111111111 353 13 13 0 1111111111111011111111111111111111111111111111111 354 14 14 0 1111111111111101111111111111111111111111111111111 355 15 15 0 1111111111111110111111111111111111111111111111111 356 16 16 0 1111111111111111011111111111111111111111111111111 357 17 17 0 1111111111111111101111111111111111111111111111111 358 18 18 0 1111111111111111110111111111111111111111111111111 359 19 19 0 1111111111111111111011111111111111111111111111111 360 20 20 0 1111111111111111111101111111111111111111111111111 361 21 21 0 1111111111111111111110111111111111111111111111111 362 22 22 0 1111111111111111111111011111111111111111111111111 363 23 23 0 1111111111111111111111101111111111111111111111111 364 24 24 0 1111111111111111111111110111111111111111111111111 365 25 25 0 1111111111111111111111111011111111111111111111111 366 26 26 0 1111111111111111111111111101111111111111111111111 367 27 27 0 1111111111111111111111111110111111111111111111111 368 28 28 0 1111111111111111111111111111011111111111111111111 369 29 29 0 1111111111111111111111111111101111111111111111111 370 30 30 0 1111111111111111111111111111110111111111111111111 371 31 31 0 1111111111111111111111111111111011111111111111111 372 32 32 0 1111111111111111111111111111111101111111111111111 373 33 33 0 1111111111111111111111111111111110111111111111111 374 34 34 0 1111111111111111111111111111111111011111111111111 375 35 35 0 1111111111111111111111111111111111101111111111111 376 36 36 0 1111111111111111111111111111111111110111111111111 377 37 37 0 1111111111111111111111111111111111111011111111111 378 38 38 0 1111111111111111111111111111111111111101111111111 379 39 39 0 1111111111111111111111111111111111111110111111111 380 40 40 0 1111111111111111111111111111111111111111011111111 381 41 41 0 1111111111111111111111111111111111111111101111111 382 42 42 0 1111111111111111111111111111111111111111110111111 383 43 43 0 1111111111111111111111111111111111111111111011111 384 44 44 0 1111111111111111111111111111111111111111111101111 385 45 45 0 1111111111111111111111111111111111111111111110111 386 46 46 0 1111111111111111111111111111111111111111111111011 387 47 47 0 1111111111111111111111111111111111111111111111101 388 48 48 0 1111111111111111111111111111111111111111111111110 389 3901 bit should move right 1 position each line 391 0 1 0 1000000000000000000000000000000000000000000000000 392 1 0 1 0100000000000000000000000000000000000000000000000 393 2 0 2 0010000000000000000000000000000000000000000000000 394 3 0 3 0001000000000000000000000000000000000000000000000 395 4 0 4 0000100000000000000000000000000000000000000000000 396 5 0 5 0000010000000000000000000000000000000000000000000 397 6 0 6 0000001000000000000000000000000000000000000000000 398 7 0 7 0000000100000000000000000000000000000000000000000 399 8 0 8 0000000010000000000000000000000000000000000000000 400 9 0 9 0000000001000000000000000000000000000000000000000 401 10 0 10 0000000000100000000000000000000000000000000000000 402 11 0 11 0000000000010000000000000000000000000000000000000 403 12 0 12 0000000000001000000000000000000000000000000000000 404 13 0 13 0000000000000100000000000000000000000000000000000 405 14 0 14 0000000000000010000000000000000000000000000000000 406 15 0 15 0000000000000001000000000000000000000000000000000 407 16 0 16 0000000000000000100000000000000000000000000000000 408 17 0 17 0000000000000000010000000000000000000000000000000 409 18 0 18 0000000000000000001000000000000000000000000000000 410 19 0 19 0000000000000000000100000000000000000000000000000 411 20 0 20 0000000000000000000010000000000000000000000000000 412 21 0 21 0000000000000000000001000000000000000000000000000 413 22 0 22 0000000000000000000000100000000000000000000000000 414 23 0 23 0000000000000000000000010000000000000000000000000 415 24 0 24 0000000000000000000000001000000000000000000000000 416 25 0 25 0000000000000000000000000100000000000000000000000 417 26 0 26 0000000000000000000000000010000000000000000000000 418 27 0 27 0000000000000000000000000001000000000000000000000 419 28 0 28 0000000000000000000000000000100000000000000000000 420 29 0 29 0000000000000000000000000000010000000000000000000 421 30 0 30 0000000000000000000000000000001000000000000000000 422 31 0 31 0000000000000000000000000000000100000000000000000 423 32 0 32 0000000000000000000000000000000010000000000000000 424 33 0 33 0000000000000000000000000000000001000000000000000 425 34 0 34 0000000000000000000000000000000000100000000000000 426 35 0 35 0000000000000000000000000000000000010000000000000 427 36 0 36 0000000000000000000000000000000000001000000000000 428 37 0 37 0000000000000000000000000000000000000100000000000 429 38 0 38 0000000000000000000000000000000000000010000000000 430 39 0 39 0000000000000000000000000000000000000001000000000 431 40 0 40 0000000000000000000000000000000000000000100000000 432 41 0 41 0000000000000000000000000000000000000000010000000 433 42 0 42 0000000000000000000000000000000000000000001000000 434 43 0 43 0000000000000000000000000000000000000000000100000 435 44 0 44 0000000000000000000000000000000000000000000010000 436 45 0 45 0000000000000000000000000000000000000000000001000 437 46 0 46 0000000000000000000000000000000000000000000000100 438 47 0 47 0000000000000000000000000000000000000000000000010 439 48 0 48 0000000000000000000000000000000000000000000000001 440