| Theodore Ts'o | ac49382 | 2001-07-04 14:04:58 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * This testing program makes sure the bitops functions work |
| 3 | * |
| 4 | * Copyright (C) 2001 by Theodore Ts'o. |
| 5 | * |
| 6 | * %Begin-Header% |
| 7 | * This file may be redistributed under the terms of the GNU Public |
| 8 | * License. |
| 9 | * %End-Header% |
| 10 | */ |
| 11 | |
| 12 | /* #define _EXT2_USE_C_VERSIONS_ */ |
| 13 | |
| 14 | #include <stdio.h> |
| 15 | #include <string.h> |
| 16 | #if HAVE_UNISTD_H |
| 17 | #include <unistd.h> |
| 18 | #endif |
| 19 | #include <fcntl.h> |
| 20 | #include <time.h> |
| 21 | #include <sys/stat.h> |
| 22 | #include <sys/types.h> |
| 23 | #if HAVE_ERRNO_H |
| 24 | #include <errno.h> |
| 25 | #endif |
| 26 | |
| 27 | #include "ext2_fs.h" |
| 28 | #include "ext2fs.h" |
| 29 | |
| 30 | unsigned char bitarray[] = { |
| 31 | 0x80, 0xF0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x10, 0x20, 0x00, 0x00 |
| 32 | }; |
| 33 | |
| 34 | main(int argc, char **argv) |
| 35 | { |
| 36 | int i, size; |
| 37 | |
| 38 | size = sizeof(bitarray)*8; |
| 39 | i = ext2fs_find_first_bit_set(bitarray, size); |
| 40 | while (i < size) { |
| 41 | printf("Bit set: %d\n", i); |
| 42 | i = ext2fs_find_next_bit_set(bitarray, size, i+1); |
| 43 | } |
| 44 | } |