libosmocore  0.9.3
Osmocom core library
bitvec.c File Reference

Osmocom bit vector abstraction. More...

#include <errno.h>
#include <stdint.h>
#include <osmocom/core/bitvec.h>

Macros

#define BITNUM_FROM_COMP(byte, bit)   ((byte*8)+bit)
 

Functions

static unsigned int bytenum_from_bitnum (unsigned int bitnum)
 
static uint8_t bitval2mask (enum bit_value bit, uint8_t bitnum)
 
enum bit_value bitvec_get_bit_pos (const struct bitvec *bv, unsigned int bitnr)
 check if the bit is 0 or 1 for a given position inside a bitvec More...
 
enum bit_value bitvec_get_bit_pos_high (const struct bitvec *bv, unsigned int bitnr)
 check if the bit is L or H for a given position inside a bitvec More...
 
unsigned int bitvec_get_nth_set_bit (const struct bitvec *bv, unsigned int n)
 get the Nth set bit inside the bit vector More...
 
int bitvec_set_bit_pos (struct bitvec *bv, unsigned int bitnr, enum bit_value bit)
 set a bit at given position in a bit vector More...
 
int bitvec_set_bit (struct bitvec *bv, enum bit_value bit)
 set the next bit inside a bitvec More...
 
int bitvec_get_bit_high (struct bitvec *bv)
 get the next bit (low/high) inside a bitvec
 
int bitvec_set_bits (struct bitvec *bv, enum bit_value *bits, int count)
 set multiple bits (based on array of bitvals) at current pos More...
 
int bitvec_set_uint (struct bitvec *bv, unsigned int ui, int num_bits)
 set multiple bits (based on numeric value) at current pos
 
int bitvec_get_uint (struct bitvec *bv, int num_bits)
 get multiple bits (based on numeric value) from current pos
 
int bitvec_spare_padding (struct bitvec *bv, unsigned int up_to_bit)
 pad all remaining bits up to num_bits
 
int bitvec_find_bit_pos (const struct bitvec *bv, unsigned int n, enum bit_value val)
 find first bit set in bit vector
 

Detailed Description

Osmocom bit vector abstraction.