summaryrefslogtreecommitdiffstats
path: root/src/bits.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bits.c')
-rw-r--r--src/bits.c45
1 files changed, 39 insertions, 6 deletions
diff --git a/src/bits.c b/src/bits.c
index ff5d176c..3955e3bb 100644
--- a/src/bits.c
+++ b/src/bits.c
@@ -3,7 +3,20 @@
#include <osmocom/core/bits.h>
-/* convert unpacked bits to packed bits, return length in bytes */
+/*! \addtogroup bits
+ * @{
+ */
+
+/*! \file bits.c
+ * \brief Osmocom bit level support code
+ */
+
+
+/*! \brief convert unpacked bits to packed bits, return length in bytes
+ * \param[out] out output buffer of packed bits
+ * \param[in] in input buffer of unpacked bits
+ * \param[in] num_bits number of bits
+ */
int osmo_ubit2pbit(pbit_t *out, const ubit_t *in, unsigned int num_bits)
{
unsigned int i;
@@ -27,7 +40,11 @@ int osmo_ubit2pbit(pbit_t *out, const ubit_t *in, unsigned int num_bits)
return outptr - out;
}
-/* convert packed bits to unpacked bits, return length in bytes */
+/*! \brief convert packed bits to unpacked bits, return length in bytes
+ * \param[out] out output buffer of unpacked bits
+ * \param[in] in input buffer of packed bits
+ * \param[in] num_bits number of bits
+ */
int osmo_pbit2ubit(ubit_t *out, const pbit_t *in, unsigned int num_bits)
{
unsigned int i;
@@ -64,8 +81,15 @@ int osmo_pbit2ubit(ubit_t *out, const pbit_t *in, unsigned int num_bits)
return cur - out;
}
-/* convert unpacked bits to packed bits (extended options but slower),
- * return length in bytes (max written ofs of output buffer + 1) */
+/*! \brief convert unpacked bits to packed bits (extended options)
+ * \param[out] out output buffer of packed bits
+ * \param[in] out_ofs offset into output buffer
+ * \param[in] in input buffer of unpacked bits
+ * \param[in] in_ofs offset into input buffer
+ * \param[in] num_bits number of bits
+ * \param[in] lsb_mode Encode bits in LSB orde instead of MSB
+ * \returns length in bytes (max written offset of output buffer + 1)
+ */
int osmo_ubit2pbit_ext(pbit_t *out, unsigned int out_ofs,
const ubit_t *in, unsigned int in_ofs,
unsigned int num_bits, int lsb_mode)
@@ -82,8 +106,15 @@ int osmo_ubit2pbit_ext(pbit_t *out, unsigned int out_ofs,
return ((out_ofs + num_bits - 1) >> 3) + 1;
}
-/* convert packed bits to unpacked bits (extended options but slower),
- * return length in bytes (max written ofs of output buffer + 1) */
+/*! \brief convert packed bits to unpacked bits (extended options)
+ * \param[out] out output buffer of unpacked bits
+ * \param[in] out_ofs offset into output buffer
+ * \param[in] in input buffer of packed bits
+ * \param[in] in_ofs offset into input buffer
+ * \param[in] num_bits number of bits
+ * \param[in] lsb_mode Encode bits in LSB orde instead of MSB
+ * \returns length in bytes (max written offset of output buffer + 1)
+ */
int osmo_pbit2ubit_ext(ubit_t *out, unsigned int out_ofs,
const pbit_t *in, unsigned int in_ofs,
unsigned int num_bits, int lsb_mode)
@@ -96,3 +127,5 @@ int osmo_pbit2ubit_ext(ubit_t *out, unsigned int out_ofs,
}
return out_ofs + num_bits;
}
+
+/*! }@ */