1d6f907dcSJoerg Wunsch /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 31de7b4b8SPedro F. Giffuni * 4ad7cf975SJoerg Wunsch * Copyright (C) 1996 5ad7cf975SJoerg Wunsch * David L. Nugent. All rights reserved. 6d6f907dcSJoerg Wunsch * 7d6f907dcSJoerg Wunsch * Redistribution and use in source and binary forms, with or without 8d6f907dcSJoerg Wunsch * modification, are permitted provided that the following conditions 9d6f907dcSJoerg Wunsch * are met: 10d6f907dcSJoerg Wunsch * 1. Redistributions of source code must retain the above copyright 11ad7cf975SJoerg Wunsch * notice, this list of conditions and the following disclaimer. 12d6f907dcSJoerg Wunsch * 2. Redistributions in binary form must reproduce the above copyright 13d6f907dcSJoerg Wunsch * notice, this list of conditions and the following disclaimer in the 14d6f907dcSJoerg Wunsch * documentation and/or other materials provided with the distribution. 15d6f907dcSJoerg Wunsch * 16ad7cf975SJoerg Wunsch * THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND 17d6f907dcSJoerg Wunsch * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18d6f907dcSJoerg Wunsch * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19ad7cf975SJoerg Wunsch * ARE DISCLAIMED. IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE 20d6f907dcSJoerg Wunsch * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21d6f907dcSJoerg Wunsch * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22d6f907dcSJoerg Wunsch * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23d6f907dcSJoerg Wunsch * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24d6f907dcSJoerg Wunsch * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25d6f907dcSJoerg Wunsch * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26d6f907dcSJoerg Wunsch * SUCH DAMAGE. 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 41379e7b73SAlfred Perlstein struct bitmap bm_alloc(int size); 42379e7b73SAlfred Perlstein void bm_dealloc(struct bitmap * bm); 43379e7b73SAlfred Perlstein void bm_setbit(struct bitmap * bm, int pos); 44379e7b73SAlfred Perlstein void bm_clrbit(struct bitmap * bm, int pos); 45379e7b73SAlfred Perlstein int bm_isset(struct bitmap * bm, int pos); 46379e7b73SAlfred Perlstein int bm_firstunset(struct bitmap * bm); 47379e7b73SAlfred Perlstein int bm_lastset(struct bitmap * bm); 48d6f907dcSJoerg Wunsch __END_DECLS 49d6f907dcSJoerg Wunsch 50d6f907dcSJoerg Wunsch #endif /* !_BITMAP_H */ 51