summaryrefslogtreecommitdiff
path: root/doc/misc_functions.rst
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-24 21:04:00 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-24 21:04:00 +0200
commit3422d8db505630a70bc89a4eee7db927b8e5ec2f (patch)
treef0c6e1ba7db9991f2bd38c9169f9921bfe5e61d8 /doc/misc_functions.rst
parentdf5167db909a88fb8e16dd20b37442495a6ac059 (diff)
parentaab49e5a013c53ae812a143fe41add74e0677a61 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'doc/misc_functions.rst')
-rw-r--r--doc/misc_functions.rst35
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/misc_functions.rst b/doc/misc_functions.rst
new file mode 100644
index 0000000..0f1bdaf
--- /dev/null
+++ b/doc/misc_functions.rst
@@ -0,0 +1,35 @@
+=======================
+Miscellaneous functions
+=======================
+
+.. code-block:: c
+
+ #include <libHX/misc.h>
+
+ int HX_ffs(unsigned long z);
+ int HX_fls(unsigned long z);
+ void HX_hexdump(FILE *fp, const void *ptr, unsigned int len);
+
+ void HX_zvecfree(char **);
+ unsigned int HX_zveclen(const char *const *);
+
+``HX_ffs``
+ Finds the first (lowest-significant) bit in a value and returns its
+ position, or ``-1`` to indicate failure.
+
+``HX_fls``
+ Finds the last (most-significant) bit in a value and returns its
+ position, or ``-1`` to indicate failure.
+
+``HX_hexdump``
+ Outputs a nice pretty-printed hex and ASCII dump to the filedescriptor
+ ``fp``. ``ptr`` is the memory area, of which ``len`` bytes will be
+ dumped.
+
+``HX_zvecfree``
+ Frees the supplied Z-vector array. (Frees all array elements from the
+ first element to (excluding) the first ``NULL`` element.)
+
+``HX_zveclen``
+ Counts the number of array elements until the first ``NULL`` array
+ element is seen, and returns this number.