LIBBITMASK(3)
π LIBBITMASK β the libbitmask(3) page, bestie edition π
okay so. sit down. hydrate. we're talking about dynamically sized multi-word bit masks and honestly? it's giving main character energy. this is the LIBBITMASK manual, straight from SGI, and i'm gonna walk you through every single function because you deserve the whole menu, not just the appetizer. β¨
πΈ NAME πΈ
bitmask, bitmask_alloc, bitmask_free, bitmask_displayhex, bitmask_displaylist, bitmask_parsehex, bitmask_parselist, bitmask_copy, bitmask_setall, bitmask_clearall, bitmask_nbytes, bitmask_mask, bitmask_nbits, bitmask_weight, bitmask_isbitset, bitmask_isbitclear, bitmask_isallset, bitmask_isallclear, bitmask_setbit, bitmask_clearbit, bitmask_equal, bitmask_subset, bitmask_disjoint, bitmask_intersects, bitmask_setrange, bitmask_clearrange, bitmask_keeprange, bitmask_complement, bitmask_shiftright, bitmask_shiftleft, bitmask_and, bitmask_andnot, bitmask_or, bitmask_eor, bitmask_first, bitmask_next, bitmask_rel_to_abs_pos, bitmask_abs_to_rel_pos, bitmask_last
...which is a LOT of names for one thing: dynamically sized multi-word bit masks. that's the whole vibe. no cap. π
β¨ SYNOPSIS β¨
first things first, you gotta pull it in:
#include <bitmask.h>
cc ... -lbitmask
that -lbitmask at link time? non-negotiable bestie, don't forget it. π«Ά
π allocate and free struct bitmask *
struct bitmask *bitmask_alloc(unsigned int nbits);
void bitmask_free(struct bitmask *bmp);
π display and parse ascii string representations
int bitmask_displayhex(char *buf, int len, const struct bitmask *bmp);
int bitmask_displaylist(char *buf, int len, const struct bitmask *bmp);
int bitmask_parsehex(const char *buf, struct bitmask *bmp);
int bitmask_parselist(const char *buf, struct bitmask *bmp);
π basic initialization operations
struct bitmask *bitmask_copy(struct bitmask *bmp1, const bitmask *bmp2);
struct bitmask *bitmask_setall(struct bitmask *bmp);
struct bitmask *bitmask_clearall(struct bitmask *bmp);
π interface to kernel sched_{set,get}affinity system calls
unsigned int bitmask_nbytes(struct bitmask *bmp);
unsigned long *bitmask_mask(struct bitmask *bmp);
π unary numeric queries
unsigned int bitmask_nbits(const struct bitmask *bmp);
unsigned int bitmask_weight(const struct bitmask *bmp);
π unary Boolean queries
int bitmask_isbitset(const struct bitmask *bmp, unsigned int i);
int bitmask_isbitclear(const struct bitmask *bmp, unsigned int i);
int bitmask_isallset(const struct bitmask *bmp);
int bitmask_isallclear(const struct bitmask *bmp);
π single bit operations
struct bitmask *bitmask_setbit(struct bitmask *bmp, unsigned int i);
struct bitmask *bitmask_clearbit(struct bitmask *bmp, unsigned int i);
π binary Boolean operations: bmp1 op? bmp2
int bitmask_equal(const struct bitmask *bmp1, const struct bitmask *bmp2);
int bitmask_subset(const struct bitmask *bmp1, const struct bitmask *bmp2);
int bitmask_disjoint(const struct bitmask *bmp1, const struct bitmask *bmp2);
int bitmask_intersects(const struct bitmask *bmp1, const struct bitmask *bmp2);
π range operations
struct bitmask *bitmask_setrange(struct bitmask *bmp, unsigned int i, unsigned int j);
struct bitmask *bitmask_clearrange(struct bitmask *bmp, unsigned int i, unsigned int j);
struct bitmask *bitmask_keeprange(struct bitmask *bmp, unsigned int i, unsigned int j);
π unary operations
struct bitmask *bitmask_complement(struct bitmask *bmp1, const bitmask *bmp2);
struct bitmask *bitmask_shiftright(struct bitmask *bmp1, const bitmask *bmp2, unsigned int n);
struct bitmask *bitmask_shiftleft(struct bitmask *bmp1, const bitmask *bmp2, unsigned int n);
π binary operations
struct bitmask *bitmask_and(struct bitmask *bmp1, const bitmask *bmp2, const bitmask *bmp3);
struct bitmask *bitmask_andnot(struct bitmask *bmp1, const bitmask *bmp2, const bitmask *bmp3);
struct bitmask *bitmask_or(struct bitmask *bmp1, const bitmask *bmp2, const bitmask *bmp3);
struct bitmask *bitmask_eor(struct bitmask *bmp1, const bitmask *bmp2, const bitmask *bmp3);
π iteration operators
int bitmask_first(const struct bitmask *bmp);
unsigned int bitmask_next(const struct bitmask *bmp, unsigned int i);
unsigned int bitmask_rel_to_abs_pos(const struct bitmask *bmp, unsigned int n);
unsigned int bitmask_abs_to_rel_pos(const struct bitmask *bmp, unsigned int n);
unsigned int bitmask_last(const struct bitmask *bmp);
π¦ DESCRIPTION π¦
okay so the page itself keeps it short and sweet: go read more. fr fr, the real tea lives here:
/usr/share/doc/packages/libbitmask/libbitmask.htmlβ the fancy version/usr/share/doc/packages/libbitmask/libbitmask.txtβ same thing but plain text, for when you're feeling minimal
that's it, that's the description. iconic of it honestly. π
π SEE ALSO π
cpuset(1)libcpuset(3)bootcpuset.conf(5)bootcpuset(8)
go read those too, bestie, the whole set is a vibe. π
π AUTHOR π
pj@sgi.com (Paul Jackson) β the legend, the moment, the whole reason this page exists. π«Ά
and that's a wrap!! this page came to you from Silicon Graphics, Inc, dated 2006-05-25, and it's the LIBBITMASK(3) manual through and through. go forth and mask some bits. π
β¨πΈ
π¦ where this page comes from
- debian bookworm: libbitmask1 2.0-5 Β· LGPL-2.1-or-later
- debian trixie: libbitmask1 2.0-5+b2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libbitmask-devel 2.0-bp160.1.4 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libbitmask-devel 2.0-bp160.1.4 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libbitmask-devel 2.0-bp160.1.4 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libbitmask-devel 2.0-bp160.1.4 Β· LGPL-2.1-or-later
- ubuntu jammy: libbitmask1 2.0-4 Β· LGPL-2.1-or-later
- ubuntu noble: libbitmask1 2.0-5 Β· LGPL-2.1-or-later
- ubuntu questing: libbitmask1 2.0-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms