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))); } }
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))); } }
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)); } }
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); }
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; }
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); }
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; } }
int get_bit(word_t *data, int b) { return data[bindex(b)] & (1 << (boffset(b))); }
void clear_bit(word_t *data, int b) { data[bindex(b)] &= ~(1 << (boffset(b))); }
void set_bit(word_t *data, int b) { data[bindex(b)] |= 1 << (boffset(b)); }
int bitset_get(struct _bitset * bitset, int b) { return bitset->words[bindex(b)] & (1 << (boffset(b))) ? 1 : 0; }
void bitset_clear(struct _bitset * bitset, int b) { bitset->words[bindex(b)] &= ~(1 << (boffset(b))); }
void bitset_set(struct _bitset * bitset, int b) { bitset->words[bindex(b)] |= 1 << (boffset(b)); }