Ejemplo n.º 1
0
int get_bit(int b, int mode) {
	if (mode == BITMAP) {
		return bitmap->data[bindex(b)] & (1 << (boffset(b)));
	} else {
		return inodemap->data[bindex(b)] & (1 << (boffset(b)));
	}
}
Ejemplo n.º 2
0
void clear_bit(int b, int mode) {
	if (mode == BITMAP) {
		bitmap->data[bindex(b)] &= ~(1 << (boffset(b)));
	} else {
		inodemap->data[bindex(b)] &= ~(1 << (boffset(b)));
	}
}
Ejemplo n.º 3
0
void set_bit(int b, int mode) {
	if (mode == BITMAP)
	{
		bitmap->data[bindex(b)] |= 1 << (boffset(b));
	} else {
		inodemap->data[bindex(b)] |= 1 << (boffset(b));
	}
}
Ejemplo n.º 4
0
Offset xxxincoff(Offset p)		/* get next blist[] block */
{
	p++;
	if (pastend(p)) {		/* off the end of this block */
		if ((p = blist[bindex(p-1)].nextoff) == -1) {	/* and nothing was allocated after it */
			ERROR "Bad storage allocation" WARN;
			done2(-5);
		}
	}
	return(p);
}
Ejemplo n.º 5
0
void ffree(Offset i)	/* free list of blocks starting at blist(o) */
{			/* (doesn't actually free the blocks, just the pointers) */
	int j;

	for ( ; blist[j = bindex(i)].nextoff != -1; ) {
		if (bfree > j)
			bfree = j;
		i = blist[j].nextoff;
		blist[j].nextoff = 0;
	}
	blist[j].nextoff = 0;
}
Ejemplo n.º 6
0
void casepm(void)
{
	int i, k;
	int xx, cnt, tcnt, kk, tot;
	Offset j;

	kk = cnt = tcnt = 0;
	tot = !skip();
	stackdump();
	for (i = 0; i < nm; i++) {
		if ((xx = contabp[i].rq) == 0 || contabp[i].mx == 0)
			continue;
		tcnt++;
		j = contabp[i].mx;
		for (k = 1; (j = blist[bindex(j)].nextoff) != -1; )
			k++; 
		cnt++;
		kk += k;
		if (!tot)
			fprintf(stderr, "%-2.2s %d\n", unpair(xx), k);
	}
	fprintf(stderr, "pm: total %d, macros %d, space %d\n", tcnt, cnt, kk);
}
Ejemplo n.º 7
0
void wbf(Tchar i)	/* store i into offset, get ready for next one */
{
	int j, off;

	if (!offset)
		return;
	j = bindex(offset);
	if (i == 0)
		contabp[savslot].emx = offset;
	off = boffset(offset);
	blist[j].bp[off++] = i;
	offset++;
	if (pastend(offset)) {	/* off the end of this block */
		if (blist[j].nextoff == -1) {
			if ((nextb = alloc()) == -1) {
				ERROR "Out of temp file space" WARN;
				done2(01);
			}
			blist[j].nextoff = nextb;
		}
		offset = blist[j].nextoff;
	}
}
Ejemplo n.º 8
0
Archivo: util.c Proyecto: psclib/pscgen
int get_bit(word_t *data, int b)
{ 
    return data[bindex(b)] & (1 << (boffset(b)));
}
Ejemplo n.º 9
0
Archivo: util.c Proyecto: psclib/pscgen
void clear_bit(word_t *data, int b)
{ 
    data[bindex(b)] &= ~(1 << (boffset(b)));
}
Ejemplo n.º 10
0
Archivo: util.c Proyecto: psclib/pscgen
void set_bit(word_t *data, int b)
{ 
    data[bindex(b)] |= 1 << (boffset(b)); 
}
Ejemplo n.º 11
0
int bitset_get(struct _bitset * bitset, int b) { 
    return bitset->words[bindex(b)] & (1 << (boffset(b))) ? 1 : 0;
}
Ejemplo n.º 12
0
void bitset_clear(struct _bitset * bitset, int b) { 
    bitset->words[bindex(b)] &= ~(1 << (boffset(b)));
}
Ejemplo n.º 13
0
void bitset_set(struct _bitset * bitset, int b) { 
    bitset->words[bindex(b)] |= 1 << (boffset(b)); 
}