libcoap  4.1.1
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Functions
bits.h File Reference

bit vector manipulation More...

#include <sys/types.h>
#include <stdint.h>

Go to the source code of this file.

Functions

static int bits_setb (uint8_t *vec, size_t size, uint8_t bit)
 Sets the bit bit in bit-vector vec. More...
 
static int bits_clrb (uint8_t *vec, size_t size, uint8_t bit)
 Clears the bit bit from bit-vector vec. More...
 
static int bits_getb (const uint8_t *vec, size_t size, uint8_t bit)
 Gets the status of bit bit from bit-vector vec. More...
 

Detailed Description

bit vector manipulation

Definition in file bits.h.

Function Documentation

static int bits_clrb ( uint8_t *  vec,
size_t  size,
uint8_t  bit 
)
inlinestatic

Clears the bit bit from bit-vector vec.

This function returns 1 if bit was cleared or -1 on error (i.e. when the given bit does not fit in the vector).

Parameters
vecThe bit-vector to change.
sizeThe size of vec in bytes.
bitThe bit to clear from vec.
Returns
-1 if bit does not fit into vec, 1 otherwise.

Definition at line 53 of file bits.h.

static int bits_getb ( const uint8_t *  vec,
size_t  size,
uint8_t  bit 
)
inlinestatic

Gets the status of bit bit from bit-vector vec.

This function returns 1 if the bit is set, 0 otherwise (even in case of an error)..

Parameters
vecThe bit-vector to read from..
sizeThe size of vec in bytes.
bitThe bit to get from vec.
Returns
1 if the bit is set, 0 otherwise.

Definition at line 72 of file bits.h.

static int bits_setb ( uint8_t *  vec,
size_t  size,
uint8_t  bit 
)
inlinestatic

Sets the bit bit in bit-vector vec.

This function returns 1 if bit was set or -1 on error (i.e. when the given bit does not fit in the vector).

Parameters
vecThe bit-vector to change.
sizeThe size of vec in bytes.
bitThe bit to set in vec.
Returns
-1 if bit does not fit into vec, 1 otherwise.

Definition at line 33 of file bits.h.