blob: 0bee579d1243f7513241b2fdf09343a54040e78a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/* See LICENSE file for copyright and license details. */
#include "internals.h"
size_t
zbits(z_t a)
{
size_t i;
zahl_char_t x;
if (zzero(a))
return 1; /* Deliver us from evil! */
for (i = a->used - 1;; i--) {
x = a->chars[i];
if (x) {
a->used = i + 1;
for (i *= BITS_PER_CHAR; x; x >>= 1, i++);
return i;
}
}
}
|