Lines Matching defs:bv

95 static const struct info *dictval2info(const bitv *bv);
110 static void bitv_free(bitv *bv);
111 static void bitv_shift(bitv *bv, unsigned bits);
112 static void bitv_setlo(bitv *bv, unsigned bits, unsigned val);
113 static void bitv_shiftin(bitv *bv, unsigned bits, unsigned val);
114 static void bitv_shiftinv(bitv *bv, unsigned bits, const bitv *inbv);
115 static int bitv_bits(const bitv *bv);
116 static unsigned bitv_chunk(const bitv *bv, unsigned limbit, unsigned lobit);
117 static int bitv_mul(bitv *bv, unsigned long long val);
118 static int bitv_add(bitv *bv, unsigned long long val);
119 static int bitv_sub(bitv *bv, unsigned long long val);
120 static int bitv_ge(const bitv *bv, unsigned long long val);
589 dictval2info(const bitv *bv)
594 if (!bitv_ge(bv, Info[i + 1].offset))
1113 struct bitv *bv = malloc(sizeof (*bv));
1115 if (bv)
1117 bv->v[i] = 0;
1119 return (bv);
1124 bitv_free(bitv *bv)
1126 free(bv);
1131 bitv_shift(bitv *bv, unsigned bits)
1142 bv->v[i] <<= iterbits;
1143 bv->v[i] |= bv->v[i - 1] >> (8 - iterbits);
1145 bv->v[0] <<= iterbits;
1153 bitv_setlo(bitv *bv, unsigned bits, unsigned val)
1168 bv->v[i] &= ~mask;
1169 bv->v[i] |= val & mask;
1174 * the following can't go off end of bv->v[] since
1185 bitv_shiftin(bitv *bv, unsigned bits, unsigned val)
1187 bitv_shift(bv, bits);
1188 bitv_setlo(bv, bits, val);
1193 bitv_shiftinv(bitv *bv, unsigned bits, const bitv *inbv)
1199 bitv_shiftin(bv, iterbits, inbv->v[byteindex--]);
1203 bitv_shiftin(bv, 8, inbv->v[byteindex--]);
1208 bitv_bits(const bitv *bv)
1213 if (bv->v[i]) {
1217 if ((bv->v[i] >> bit) & 1)
1229 bitv_chunk(const bitv *bv, unsigned limbit, unsigned lobit)
1242 retval |= (bv->v[bit / 8] >> (bit % 8)) & 1;
1256 bitv_mul(bitv *bv, unsigned long long val)
1271 /* from most significant byte of bv to least */
1274 bv->v[bvbyte] + k;
1293 /* store result in bv */
1295 bv->v[i] = prod[i];
1308 bitv_add(bitv *bv, unsigned long long val)
1316 result = cf + bv->v[i] + ((val >> (i * 8)) & 0xff);
1318 result = cf + bv->v[i];
1321 bv->v[i] = result & 0xff;
1339 bitv_sub(bitv *bv, unsigned long long val)
1347 minuend = bv->v[i];
1358 bv->v[i] = minuend - subtrahend;
1369 * see if bv is greater than or equal to a given value
1372 bitv_ge(const bitv *bv, unsigned long long val)
1380 minuend = bv->v[i];
1400 bitv *bv = bitv_alloc();
1402 if (bv == NULL) {
1434 if (bitv_mul(bv, base) < 0 ||
1435 bitv_add(bv, val) < 0 ||
1436 bitv_bits(bv) > bits) {
1437 bitv_free(bv);
1445 return (bv);