Introduction
Introduction Statistics Contact Development Disclaimer Help
zbits.3 - libzahl - big integer library
git clone git://git.suckless.org/libzahl
Log
Files
Refs
README
LICENSE
---
zbits.3 (707B)
---
1 .TH ZBITS 3 libzahl
2 .SH NAME
3 zbits - Count used bits in a big integer
4 .SH SYNOPSIS
5 .nf
6 #include <zahl.h>
7
8 size_t zbits(z_t \fIa\fP);
9 .fi
10 .SH DESCRIPTION
11 .B zbits
12 calculates the bit-size of
13 .IR a .
14 If
15 .I a
16 is zero the bit-size is 1.
17 .SH RETURN VALUE
18 .B zbits
19 returns the number of bits requires
20 to represent
21 .I a
22 \(em 1 plus the floored binary logarithm of the
23 absolute value of
24 .I a
25 \(em or 1 if
26 .I a
27 is zero.
28 .SH RATIONALE
29 .B zbits
30 returns 1 rather than 0 if
31 .B a
32 is zero, this is to avoid off-by-one errors
33 and it is the number of digits requires to
34 write the number in binary. You will see this
35 in corresponding functions in other libraries.
36 .SH SEE ALSO
37 .BR zlsb (3),
38 .BR zzero (3),
39 .BR zstr_length (3)
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.