xref: /freebsd/usr.sbin/pw/bitmap.h (revision ad7cf975be77baeff1c1e4561cff52a0214af1da)
1d6f907dcSJoerg Wunsch /*-
2ad7cf975SJoerg Wunsch  * Copyright (C) 1996
3ad7cf975SJoerg Wunsch  *	David L. Nugent.  All rights reserved.
4d6f907dcSJoerg Wunsch  *
5d6f907dcSJoerg Wunsch  * Redistribution and use in source and binary forms, with or without
6d6f907dcSJoerg Wunsch  * modification, are permitted provided that the following conditions
7d6f907dcSJoerg Wunsch  * are met:
8d6f907dcSJoerg Wunsch  * 1. Redistributions of source code must retain the above copyright
9ad7cf975SJoerg Wunsch  *    notice, this list of conditions and the following disclaimer.
10d6f907dcSJoerg Wunsch  * 2. Redistributions in binary form must reproduce the above copyright
11d6f907dcSJoerg Wunsch  *    notice, this list of conditions and the following disclaimer in the
12d6f907dcSJoerg Wunsch  *    documentation and/or other materials provided with the distribution.
13d6f907dcSJoerg Wunsch  *
14ad7cf975SJoerg Wunsch  * THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND
15d6f907dcSJoerg Wunsch  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16d6f907dcSJoerg Wunsch  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17ad7cf975SJoerg Wunsch  * ARE DISCLAIMED.  IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE
18d6f907dcSJoerg Wunsch  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19d6f907dcSJoerg Wunsch  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20d6f907dcSJoerg Wunsch  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21d6f907dcSJoerg Wunsch  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22d6f907dcSJoerg Wunsch  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23d6f907dcSJoerg Wunsch  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24d6f907dcSJoerg Wunsch  * SUCH DAMAGE.
25d6f907dcSJoerg Wunsch  *
26ad7cf975SJoerg Wunsch  *	$Id: bitmap.h,v 1.1.1.1 1996/12/09 14:05:35 joerg Exp $
27d6f907dcSJoerg Wunsch  */
28d6f907dcSJoerg Wunsch 
29d6f907dcSJoerg Wunsch #ifndef _BITMAP_H_
30d6f907dcSJoerg Wunsch #define _BITMAP_H_
31d6f907dcSJoerg Wunsch 
32d6f907dcSJoerg Wunsch #include <sys/cdefs.h>
33d6f907dcSJoerg Wunsch 
34d6f907dcSJoerg Wunsch struct bitmap
35d6f907dcSJoerg Wunsch {
36d6f907dcSJoerg Wunsch 	int	      size;
37d6f907dcSJoerg Wunsch 	unsigned char *map;
38d6f907dcSJoerg Wunsch };
39d6f907dcSJoerg Wunsch 
40d6f907dcSJoerg Wunsch __BEGIN_DECLS
41d6f907dcSJoerg Wunsch struct bitmap bm_alloc __P((int size));
42d6f907dcSJoerg Wunsch void bm_dealloc __P((struct bitmap * bm));
43d6f907dcSJoerg Wunsch void bm_setbit __P((struct bitmap * bm, int pos));
44d6f907dcSJoerg Wunsch void bm_clrbit __P((struct bitmap * bm, int pos));
45d6f907dcSJoerg Wunsch int bm_isset __P((struct bitmap * bm, int pos));
46d6f907dcSJoerg Wunsch int bm_firstunset __P((struct bitmap * bm));
47d6f907dcSJoerg Wunsch int bm_lastset __P((struct bitmap * bm));
48d6f907dcSJoerg Wunsch __END_DECLS
49d6f907dcSJoerg Wunsch 
50d6f907dcSJoerg Wunsch #endif				/* !_BITMAP_H */
51