summaryrefslogtreecommitdiff
path: root/doc/libstddjb/bitarray.html
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-09-18 18:55:44 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-09-18 18:55:44 +0000
commit3534b428629be185e096be99e3bd5fdfe32d5544 (patch)
tree210ef3198ed66bc7f7b7bf6a85e4579f455e5a36 /doc/libstddjb/bitarray.html
downloadskalibs-3534b428629be185e096be99e3bd5fdfe32d5544.tar.xz
initial commit with rc for skalibs-2.0.0.0
Diffstat (limited to 'doc/libstddjb/bitarray.html')
-rw-r--r--doc/libstddjb/bitarray.html131
1 files changed, 131 insertions, 0 deletions
diff --git a/doc/libstddjb/bitarray.html b/doc/libstddjb/bitarray.html
new file mode 100644
index 0000000..1f88c3d
--- /dev/null
+++ b/doc/libstddjb/bitarray.html
@@ -0,0 +1,131 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>skalibs: the bitarray library interface</title>
+ <meta name="Description" content="skalibs: the bitarray library interface" />
+ <meta name="Keywords" content="skalibs c unix bitarray library libstddjb" />
+ <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">libstddjb</a><br />
+<a href="../libskarnet.html">libskarnet</a><br />
+<a href="../index.html">skalibs</a><br />
+<a href="http://skarnet.org/software/">Software</a><br />
+<a href="http://skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>bitarray</tt> library interface </h1>
+
+<p>
+ The following functions are declared in the <tt>skalibs/bitarray.h</tt> header,
+and implemented in the <tt>libskarnet.a</tt> or <tt>libskarnet.so</tt> library.
+</p>
+
+<h2> General information </h2>
+
+<p>
+ <tt>bitarray</tt> is a set of primitives to operate efficiently on
+large bitfields.
+</p>
+
+<p>
+ A bitfield is represented by a pre-allocated block of
+<tt>unsigned char</tt>; <tt>bitarray</tt> does not care if that
+block has been BSS-, stack- or heap-allocated. Bitfields that
+can grow in size should be stored in a
+<a href="stralloc.html">stralloc</a>.
+</p>
+
+<p>
+ Bits in a bitfield of length <em>n</em> are numbered from 0 to <em>n</em>-1.
+</p>
+
+<h2> Functions </h2>
+
+<p>
+<code> unsigned int bitarray_div8 (unsigned int n) </code> <br />
+Returns the minimum number of bytes needed to store a field of <em>n</em> bits.
+
+</p>
+
+<p>
+<code> void bitarray_clearsetn (unsigned char *s, unsigned int start, unsigned int len, int h) </code> <br />
+Sets (if <em>h</em> is nonzero) or clears (if <em>h</em> is zero)
+<em>len</em> bits in field <em>s</em>, starting at bit <em>start</em>.
+</p>
+
+<p>
+<code> void bitarray_clearn (unsigned char *s, unsigned int start, unsigned int len) </code> <br />
+Clears <em>len</em> bits in field <em>s</em>, starting at bit <em>start</em>.
+</p>
+
+<p>
+<code> void bitarray_setn (unsigned char *s, unsigned int start, unsigned int len) </code> <br />
+Sets <em>len</em> bits in field <em>s</em>, starting at bit <em>start</em>.
+</p>
+
+<p>
+<code> int bitarray_peek (unsigned char const *s, unsigned int n) </code> <br />
+Returns the value of the <em>n</em>th bit in field <em>s</em>.
+</p>
+
+<p>
+<code> void bitarray_poke (unsigned char *s, unsigned int n, int h) </code> <br />
+Sets (if <em>h</em> is nonzero) or clears (if <em>h</em> is zero)
+the <em>n</em>th bit in field <em>s</em>.
+</p>
+
+<p>
+<code> void bitarray_clear (unsigned char *s, unsigned int n) </code> <br />
+Clears the <em>n</em>th bit in field <em>s</em>.
+</p>
+
+<p>
+<code> void bitarray_set (unsigned char *s, unsigned int n) </code> <br />
+Sets the <em>n</em>th bit in field <em>s</em>.
+</p>
+
+<p>
+<code> int bitarray_testandpoke (unsigned char *s, unsigned int n, int h) </code> <br />
+Sets (if <em>h</em> is nonzero) or clears (if <em>h</em> is zero)
+the <em>n</em>th bit in field <em>s</em>,
+and returns the previous value of that bit.
+</p>
+
+<p>
+<code> int bitarray_testandclear (unsigned char *s, unsigned int n) </code> <br />
+Clear the <em>n</em>th bit in field <em>s</em>,
+and returns the previous value of that bit.
+</p>
+
+<p>
+<code> int bitarray_testandset (unsigned char *s, unsigned int n) </code> <br />
+Sets the <em>n</em>th bit in field <em>s</em>,
+and returns the previous value of that bit.
+</p>
+
+<p>
+<code> unsigned int bitarray_first (unsigned char const *s, unsigned int len, int h) </code> <br />
+Returns the number of the first set (if <em>h</em> is nonzero) or clear
+(if <em>h</em> is zero) bit in <em>s</em>, <em>len</em> being
+the total number of bits. If all bits in <em>s</em> are the negation of
+<em>h</em>, then <em>len</em> is returned.
+</p>
+
+<p>
+<code> unsigned int bitarray_firstclear (unsigned char const *s, unsigned int len) </code> <br />
+Returns the number of the first clear bit in <em>s</em>, <em>len</em> being
+the total number of bits. If all bits in <em>s</em> are set, <em>len</em> is returned.
+</p>
+
+<p>
+<code> unsigned int bitarray_firstset (unsigned char const *s, unsigned int len) </code> <br />
+Returns the number of the first set bit in <em>s</em>, <em>len</em> being
+the total number of bits. If all bits in <em>s</em> are clear, <em>len</em> is returned.
+</p>
+
+</body>
+</html>