|
libcoap
4.2.1
|
Bit vector manipulation. More...
#include <stdint.h>
Include dependency graph for bits.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| COAP_STATIC_INLINE int | bits_setb (uint8_t *vec, size_t size, uint8_t bit) |
Sets the bit bit in bit-vector vec. More... | |
| COAP_STATIC_INLINE int | bits_clrb (uint8_t *vec, size_t size, uint8_t bit) |
Clears the bit bit from bit-vector vec. More... | |
| COAP_STATIC_INLINE int | bits_getb (const uint8_t *vec, size_t size, uint8_t bit) |
Gets the status of bit bit from bit-vector vec. More... | |
Bit vector manipulation.
Definition in file bits.h.
| COAP_STATIC_INLINE int bits_clrb | ( | uint8_t * | vec, |
| size_t | size, | ||
| uint8_t | bit | ||
| ) |
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).
| vec | The bit-vector to change. |
| size | The size of vec in bytes. |
| bit | The bit to clear from vec. |
-1 if bit does not fit into vec, 1 otherwise. | COAP_STATIC_INLINE int bits_getb | ( | const uint8_t * | vec, |
| size_t | size, | ||
| uint8_t | bit | ||
| ) |
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).
| vec | The bit-vector to read from. |
| size | The size of vec in bytes. |
| bit | The bit to get from vec. |
1 if the bit is set, 0 otherwise. | COAP_STATIC_INLINE int bits_setb | ( | uint8_t * | vec, |
| size_t | size, | ||
| uint8_t | bit | ||
| ) |
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).
| vec | The bit-vector to change. |
| size | The size of vec in bytes. |
| bit | The bit to set in vec. |
-1 if bit does not fit into vec, 1 otherwise.