diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-02-10 15:27:06 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-02-10 15:27:06 +0100 |
commit | 7501bff8432444b7ae8e7f3d9289c0d61f3f0b64 (patch) | |
tree | bd53603f464c3747e897a8996158a0fef7b41bc3 /doc/misc_functions.rst | |
parent | 0f124df68d87c9073f76efeff1a901a69b1f3e13 (diff) | |
parent | 9e9336185f86bd97ff22f54e4d561c2cccccecf5 (diff) |
Merge branch 'release/debian/4.10-1'debian/4.10-1
Diffstat (limited to 'doc/misc_functions.rst')
-rw-r--r-- | doc/misc_functions.rst | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/misc_functions.rst b/doc/misc_functions.rst new file mode 100644 index 0000000..43dacfe --- /dev/null +++ b/doc/misc_functions.rst @@ -0,0 +1,39 @@ +======================= +Miscellaneous functions +======================= + +.. code-block:: c + + #include <libHX/misc.h> + + int HX_ffs(unsigned long z); + int HX_fls(unsigned long z); + + 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_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. + +.. code-block:: c + + #include <libHX/io.h> + void HX_hexdump(FILE *fp, const void *ptr, unsigned int len); + +``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. |