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... | |
bit vector manipulation
Definition in file bits.h.
|
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).
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.
|
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)..
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.
|
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).
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.