![]() |
![]() |
![]() |
liboscats Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
struct GBitArray; GBitArray * g_bit_array_new (guint bit_length
); GBitArray * g_bit_array_resize (GBitArray *array
,guint bit_length
); GBitArray * g_bit_array_extend (GBitArray *array
,guint num
); void g_bit_array_copy (GBitArray *lhs
,const GBitArray *rhs
); guint g_bit_array_get_len (const GBitArray *array
); guint g_bit_array_get_num_set (const GBitArray *array
); gboolean g_bit_array_get_bit (const GBitArray *array
,guint pos
); GBitArray * g_bit_array_set_bit (GBitArray *array
,guint pos
); GBitArray * g_bit_array_clear_bit (GBitArray *array
,guint pos
); gboolean g_bit_array_flip_bit (GBitArray *array
,guint pos
); GBitArray * g_bit_array_set_bit_val (GBitArray *array
,guint pos
,gboolean val
); GBitArray * g_bit_array_set_range (GBitArray *array
,guint start
,guint stop
,gboolean val
); GBitArray * g_bit_array_reset (GBitArray *array
,gboolean val
); gboolean g_bit_array_equal (GBitArray *lhs
,GBitArray *rhs
); gint g_bit_array_serial_compare (const GBitArray *a
,const GBitArray *b
); void g_bit_array_iter_reset (GBitArray *array
); gint g_bit_array_iter_next (GBitArray *array
);
GBitArray * g_bit_array_new (guint bit_length
);
Returns a new GBitArray with the given length. Note that the bit states are undefined.
|
the number of bits |
Returns : |
the new GBitArray |
GBitArray * g_bit_array_resize (GBitArray *array
,guint bit_length
);
Resizes the GBitArray to the specified length. All bits are cleared after this operation.
GBitArray * g_bit_array_extend (GBitArray *array
,guint num
);
Extends array
by num
bits. Unlike g_bit_array_resize()
, maintains
the existing bits. New bits are cleared.
void g_bit_array_copy (GBitArray *lhs
,const GBitArray *rhs
);
Resizes lhs
as necessary.
guint g_bit_array_get_len (const GBitArray *array
);
Returns the bit length of the array.
|
a GBitArray |
Returns : |
the length of the array in bits |
guint g_bit_array_get_num_set (const GBitArray *array
);
|
a GBitArray |
Returns : |
the number of bits that are set |
gboolean g_bit_array_get_bit (const GBitArray *array
,guint pos
);
Returns whether or not the bit indexed by pos
is set.
The index must satisfy 0 <= pos
< length.
|
a GBitArray |
|
the index of the bit to query |
Returns : |
gboolean status |
GBitArray * g_bit_array_set_bit (GBitArray *array
,guint pos
);
Sets the bit indexed by pos
to TRUE
.
The index must satisfy 0 <= pos
< length.
GBitArray * g_bit_array_clear_bit (GBitArray *array
,guint pos
);
Sets the bit indexed by pos
to FALSE
.
The index must satisfy 0 <= pos
< length.
gboolean g_bit_array_flip_bit (GBitArray *array
,guint pos
);
Negates the bit indexed by pos
.
The index must satisfy 0 <= pos
< length.
|
a GBitArray |
|
the index of the bit to flip |
Returns : |
the new value of the bit |
GBitArray * g_bit_array_set_bit_val (GBitArray *array
,guint pos
,gboolean val
);
Sets the bit indexed by pos
to val
.
The index must satisfy 0 <= pos
< length.
GBitArray * g_bit_array_set_range (GBitArray *array
,guint start
,guint stop
,gboolean val
);
Sets all of the bits between start
and stop
(inclusive) to val
.
The indeces must satisfy 0 <= start
<= stop
< length.
GBitArray * g_bit_array_reset (GBitArray *array
,gboolean val
);
Sets all of the bits in the array to val
.
gboolean g_bit_array_equal (GBitArray *lhs
,GBitArray *rhs
);
If lhs
and rhs
are not the same length, returns FALSE
.
gint g_bit_array_serial_compare (const GBitArray *a
,const GBitArray *b
);
Compares a serialization of a
and b
. The serialization interprets
the bit array as a base-2 integer.
void g_bit_array_iter_reset (GBitArray *array
);
Restarts the iterator at the beginning. The next call to
g_bit_array_iter_next()
will return the index of the first true bit.
|
a GBitArray |