set.c: use __builtin_ffs to count vlen bits
This commit is contained in:
parent
292af70160
commit
0cfbd8401f
17
lib/set.c
17
lib/set.c
@ -534,20 +534,19 @@ int decode_base62_golomb(const char *base62, int Mshift, unsigned *v)
|
||||
c >>= n - left;
|
||||
n = left;
|
||||
vlen:
|
||||
do {
|
||||
n--;
|
||||
if (c & 1) {
|
||||
c >>= 1;
|
||||
if (c == 0) {
|
||||
q += n;
|
||||
return;
|
||||
}
|
||||
int vbits = __builtin_ffs(c);
|
||||
n -= vbits;
|
||||
c >>= vbits;
|
||||
q += vbits - 1;
|
||||
r = c;
|
||||
rfill = n;
|
||||
state = ST_MBITS;
|
||||
goto rcheck;
|
||||
}
|
||||
c >>= 1;
|
||||
q++;
|
||||
}
|
||||
while (n > 0);
|
||||
}
|
||||
inline void put4bits(unsigned c) { putNbits(c, 4); }
|
||||
inline void put6bits(unsigned c) { putNbits(c, 6); }
|
||||
inline void put10bits(unsigned c) { putNbits(c, 10); }
|
||||
|
Loading…
Reference in New Issue
Block a user