Lely core libraries
2.3.4
|
#include <lely/util/util.h>
Go to the source code of this file.
Data Structures | |
struct | bitset |
A variable-sized bitset. More... | |
Functions | |
int | bitset_init (struct bitset *set, int size) |
Initializes a bitset. More... | |
void | bitset_fini (struct bitset *set) |
Finalizes a bitset. More... | |
int | bitset_size (const struct bitset *set) |
Returns the size (in number of bits) of set. | |
int | bitset_resize (struct bitset *set, int size) |
Resizes a bitset. More... | |
int | bitset_test (const struct bitset *set, int n) |
Returns 1 if bit n in set is set, and 0 otherwise. | |
void | bitset_set (struct bitset *set, int n) |
Sets bit n in set. | |
void | bitset_set_all (struct bitset *set) |
Sets all bits in set. | |
void | bitset_clr (struct bitset *set, int n) |
Clears bit n in set. | |
void | bitset_clr_all (struct bitset *set) |
Clears all bits in set. | |
void | bitset_compl (struct bitset *set) |
Flip all bits in set. | |
int | bitset_ffs (const struct bitset *set) |
Returns the index (starting from one) of the first set bit in set, or 0 if all bits are zero. | |
int | bitset_ffz (const struct bitset *set) |
Returns the index (starting from one) of the first zero bit in set, or 0 if all bits are set. | |
int | bitset_fns (const struct bitset *set, int n) |
Returns the index (starting from one) of the first set bit higher or equal to n in set, or 0 if all bits starting from n are zero. | |
int | bitset_fnz (const struct bitset *set, int n) |
Returns the index (starting from one) of the first zero bit higher or equal to n in set, or 0 if all bits starting from n are set. | |
This header file is part of the utilities library; it contains the bitset declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file bitset.h.
int bitset_init | ( | struct bitset * | set, |
int | size | ||
) |
Initializes a bitset.
On success, all bits are cleared.
set | a pointer to a bitset. |
size | the requested size (in number of bits) of the set. This number is rounded up to the nearest multiple of sizeof(int) * CHAR_BIT . |
void bitset_fini | ( | struct bitset * | set | ) |
int bitset_resize | ( | struct bitset * | set, |
int | size | ||
) |
Resizes a bitset.
On success, if the set has grown, all new bits are cleared.
set | a pointer to a bitset. |
size | the requester size (in number of bits) of the set. This number is rounded up to the nearest multiple of sizeof(int) * CHAR_BIT . |