aboutsummaryrefslogtreecommitdiffstats
path: root/src/bitvec.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-01-28 12:07:12 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-01-30 10:18:38 +0100
commit912bc6ff5047f08bb55c1d08be5fe4485e37e5d6 (patch)
tree211e14e230ba454b03747dbb87db6c6cdb814582 /src/bitvec.c
parent2745b489406ffe1e326c45b3ac2134457efd4d80 (diff)
Add doxygen comments to clarify function use
Diffstat (limited to 'src/bitvec.c')
-rw-r--r--src/bitvec.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bitvec.c b/src/bitvec.c
index 2db62efa..46e83f36 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -138,6 +138,7 @@ unsigned int bitvec_get_nth_set_bit(const struct bitvec *bv, unsigned int n)
* \param[in] bv bit vector on which to operate
* \param[in] bitnr number of bit to be set
* \param[in] bit value to which the bit is to be set
+ * \returns 0 on success, negative value on error
*/
int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnr,
enum bit_value bit)
@@ -163,6 +164,7 @@ int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnr,
/*! \brief set the next bit inside a bitvec
* \param[in] bv bit vector to be used
* \param[in] bit value of the bit to be set
+ * \returns 0 on success, negative value on error
*/
int bitvec_set_bit(struct bitvec *bv, enum bit_value bit)
{
@@ -397,6 +399,12 @@ int bitvec_unhex(struct bitvec *bv, const char *src)
return 0;
}
+/*! \brief read part of the vector
+ * \param[in] bv The boolean vector to work on
+ * \param[in] read_index Where reading supposed to start in the vector
+ * \param[in] len How many bits to read from vector
+ * \returns read bits or negative value on error
+ */
uint64_t bitvec_read_field(struct bitvec *bv, unsigned int read_index, unsigned int len)
{
unsigned int i;
@@ -415,7 +423,12 @@ uint64_t bitvec_read_field(struct bitvec *bv, unsigned int read_index, unsigned
return ui;
}
-
+/*! \brief write into the vector
+ * \param[in] bv The boolean vector to work on
+ * \param[in] write_index Where writing supposed to start in the vector
+ * \param[in] len How many bits to write
+ * \returns next write index or negative value on error
+ */
int bitvec_write_field(struct bitvec *bv, unsigned int write_index, uint64_t val, unsigned int len)
{
unsigned int i;