120253Sjoerg/*-
2330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3330449Seadler *
420302Sjoerg * Copyright (C) 1996
520302Sjoerg *	David L. Nugent.  All rights reserved.
620253Sjoerg *
720253Sjoerg * Redistribution and use in source and binary forms, with or without
820253Sjoerg * modification, are permitted provided that the following conditions
920253Sjoerg * are met:
1020253Sjoerg * 1. Redistributions of source code must retain the above copyright
1120302Sjoerg *    notice, this list of conditions and the following disclaimer.
1220253Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
1320253Sjoerg *    notice, this list of conditions and the following disclaimer in the
1420253Sjoerg *    documentation and/or other materials provided with the distribution.
1520253Sjoerg *
1620302Sjoerg * THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND
1720253Sjoerg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1820253Sjoerg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1920302Sjoerg * ARE DISCLAIMED.  IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE
2020253Sjoerg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2120253Sjoerg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2220253Sjoerg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2320253Sjoerg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2420253Sjoerg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2520253Sjoerg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2620253Sjoerg * SUCH DAMAGE.
2720253Sjoerg *
2850479Speter * $FreeBSD: stable/11/usr.sbin/pw/bitmap.h 330449 2018-03-05 07:26:05Z eadler $
2920253Sjoerg */
3020253Sjoerg
3120253Sjoerg#ifndef _BITMAP_H_
3220253Sjoerg#define _BITMAP_H_
3320253Sjoerg
3420253Sjoerg#include <sys/cdefs.h>
3520253Sjoerg
3620253Sjoergstruct bitmap
3720253Sjoerg{
3820253Sjoerg	int	      size;
3920253Sjoerg	unsigned char *map;
4020253Sjoerg};
4120253Sjoerg
4220253Sjoerg__BEGIN_DECLS
4399806Salfredstruct bitmap bm_alloc(int size);
4499806Salfredvoid bm_dealloc(struct bitmap * bm);
4599806Salfredvoid bm_setbit(struct bitmap * bm, int pos);
4699806Salfredvoid bm_clrbit(struct bitmap * bm, int pos);
4799806Salfredint bm_isset(struct bitmap * bm, int pos);
4899806Salfredint bm_firstunset(struct bitmap * bm);
4999806Salfredint bm_lastset(struct bitmap * bm);
5020253Sjoerg__END_DECLS
5120253Sjoerg
5220253Sjoerg#endif				/* !_BITMAP_H */
53