/* Initialize a new bitmap page. Bitmap pages are left in memory once they are read in.  */
int __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
/* Initialize a new bitmap page. Bitmap pages are left in memory once they are read in.  */
int __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
{
	u_int32_t *ip;
	int clearbytes, clearints;
	if ((ip = (u_int32_t *)malloc(hashp->BSIZE)) == NULL)
		return (1);
	hashp->nmaps++;
	clearints = ((nbits - 1) >> INT_BYTE_SHIFT) + 1;
	clearbytes = clearints << INT_TO_BYTE;
	(void)memset((char *)ip, 0, clearbytes);
	(void)memset(((char *)ip) + clearbytes, 0xFF,
	    hashp->BSIZE - clearbytes);
	ip[clearints - 1] = ALL_SET << (nbits & BYTE_MASK);
	SETBIT(ip, 0);
	hashp->BITMAPS[ndx] = (u_int16_t)pnum;
	hashp->mapp[ndx] = ip;
	return (0);
}