Changeset View
Changeset View
Standalone View
Standalone View
share/man/man3/bitstring.3
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm bit_alloc , | .Nm bit_alloc , | ||||
.Nm bit_clear , | .Nm bit_clear , | ||||
.Nm bit_count , | .Nm bit_count , | ||||
.Nm bit_decl , | .Nm bit_decl , | ||||
.Nm bit_ffc , | .Nm bit_ffc , | ||||
.Nm bit_ffs , | .Nm bit_ffs , | ||||
.Nm bit_ff_at , | |||||
.Nm bit_ffc_at , | .Nm bit_ffc_at , | ||||
.Nm bit_ffs_at , | .Nm bit_ffs_at , | ||||
.Nm bit_ffc_area , | .Nm bit_ffc_area , | ||||
.Nm bit_ffs_area , | .Nm bit_ffs_area , | ||||
.Nm bit_ff_area_at , | |||||
.Nm bit_ffc_area_at , | .Nm bit_ffc_area_at , | ||||
.Nm bit_ffs_area_at , | .Nm bit_ffs_area_at , | ||||
.Nm bit_nclear , | .Nm bit_nclear , | ||||
.Nm bit_nset , | .Nm bit_nset , | ||||
.Nm bit_ntest , | |||||
.Nm bit_set , | .Nm bit_set , | ||||
.Nm bit_test , | .Nm bit_test , | ||||
.Nm bitstr_size | .Nm bitstr_size | ||||
.Nd bit-string manipulation functions and macros | .Nd bit-string manipulation functions and macros | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In bitstring.h | .In bitstring.h | ||||
.Ft bitstr_t * | .Ft bitstr_t * | ||||
.Fn bit_alloc "int nbits" | .Fn bit_alloc "int nbits" | ||||
.Ft void | .Ft void | ||||
.Fn bit_decl "bitstr_t *name" "int nbits" | .Fn bit_decl "bitstr_t *name" "int nbits" | ||||
.Ft void | .Ft void | ||||
.Fn bit_clear "bitstr_t *name" "int bit" | .Fn bit_clear "bitstr_t *name" "int bit" | ||||
.Ft void | .Ft void | ||||
.Fn bit_count "bitstr_t *name" "int count" "int nbits" "int *value" | .Fn bit_count "bitstr_t *name" "int count" "int nbits" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffc "bitstr_t *name" "int nbits" "int *value" | .Fn bit_ffc "bitstr_t *name" "int nbits" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffs "bitstr_t *name" "int nbits" "int *value" | .Fn bit_ffs "bitstr_t *name" "int nbits" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffc_at "bitstr_t *name" "int start" "int nbits" "int *value" | .Fn bit_ffc_at "bitstr_t *name" "int start" "int nbits" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffs_at "bitstr_t *name" "int start" "int nbits" "int *value" | .Fn bit_ffs_at "bitstr_t *name" "int start" "int nbits" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ff_at "bitstr_t *name" "int start" "int nbits" "int match" "int *value" | |||||
.Ft void | |||||
.Fn bit_ffc_area "bitstr_t *name" "int nbits" "int size" "int *value" | .Fn bit_ffc_area "bitstr_t *name" "int nbits" "int size" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffs_area "bitstr_t *name" "int nbits" "int size" "int *value" | .Fn bit_ffs_area "bitstr_t *name" "int nbits" "int size" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffc_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" | .Fn bit_ffc_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" | ||||
.Ft void | .Ft void | ||||
.Fn bit_ffs_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" | .Fn bit_ffs_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" | ||||
.Ft void | |||||
.Fn bit_ff_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int match" "int *value" | |||||
.Fn bit_foreach "bitstr_t *name" "int nbits" "int var" | .Fn bit_foreach "bitstr_t *name" "int nbits" "int var" | ||||
.Fn bit_foreach_at "bitstr_t *name" "int start" "int nbits" "int var" | .Fn bit_foreach_at "bitstr_t *name" "int start" "int nbits" "int var" | ||||
.Fn bit_foreach_unset "bitstr_t *name" "int nbits" "int var" | .Fn bit_foreach_unset "bitstr_t *name" "int nbits" "int var" | ||||
.Fn bit_foreach_unset_at "bitstr_t *name" "int start" "int nbits" "int var" | .Fn bit_foreach_unset_at "bitstr_t *name" "int start" "int nbits" "int var" | ||||
.Ft void | .Ft void | ||||
.Fn bit_nclear "bitstr_t *name" "int start" "int stop" | .Fn bit_nclear "bitstr_t *name" "int start" "int stop" | ||||
.Ft void | .Ft void | ||||
.Fn bit_nset "bitstr_t *name" "int start" "int stop" | .Fn bit_nset "bitstr_t *name" "int start" "int stop" | ||||
.Ft int | |||||
.Fn bit_ntest "bitstr_t *name" "int start" "int stop" "int match" | |||||
.Ft void | .Ft void | ||||
.Fn bit_set "bitstr_t *name" "int bit" | .Fn bit_set "bitstr_t *name" "int bit" | ||||
.Ft int | .Ft int | ||||
.Fn bitstr_size "int nbits" | .Fn bitstr_size "int nbits" | ||||
.Ft int | .Ft int | ||||
.Fn bit_test "bitstr_t *name" "int bit" | .Fn bit_test "bitstr_t *name" "int bit" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
These macros operate on strings of bits. | These macros operate on strings of bits. | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
.Fn bit_test | .Fn bit_test | ||||
function | function | ||||
evaluates to non-zero if the zero-based numbered bit | evaluates to non-zero if the zero-based numbered bit | ||||
.Fa bit | .Fa bit | ||||
of bit string | of bit string | ||||
.Fa name | .Fa name | ||||
is set, and zero otherwise. | is set, and zero otherwise. | ||||
.Pp | .Pp | ||||
The | |||||
.Fn bit_ntest | |||||
function | |||||
evaluates to non-zero if the zero-based numbered bits from | |||||
.Fa start | |||||
through | |||||
.Fa stop | |||||
in the bit string | |||||
.Ar name | |||||
all have the value | |||||
.Ar match . | |||||
.Pp | |||||
The function | The function | ||||
.Fn bit_ffc | .Fn bit_ffc | ||||
stores in the location referenced by | stores in the location referenced by | ||||
.Fa value | .Fa value | ||||
the zero-based number of the first bit not set in the array of | the zero-based number of the first bit not set in the array of | ||||
.Fa nbits | .Fa nbits | ||||
bits referenced by | bits referenced by | ||||
.Fa name . | .Fa name . | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
.Fa start . | .Fa start . | ||||
If no bits are set after | If no bits are set after | ||||
.Fa start , | .Fa start , | ||||
the location referenced by | the location referenced by | ||||
.Fa value | .Fa value | ||||
is set to \-1. | is set to \-1. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn bit_ff_at | |||||
function | |||||
stores in the location referenced by | |||||
.Fa value | |||||
the zero-based number of the first bit in the array of | |||||
.Fa nbits | |||||
bits referenced by | |||||
.Fa name , | |||||
at or after the zero-based bit index | |||||
.Fa start | |||||
that has value | |||||
.Fa match . | |||||
If no bits after | |||||
.Fa start | |||||
match that value, the location referenced by | |||||
.Fa value | |||||
is set to \-1. | |||||
.Pp | |||||
The | |||||
.Fn bit_ffc_area | .Fn bit_ffc_area | ||||
function stores in the location referenced by | function stores in the location referenced by | ||||
.Fa value | .Fa value | ||||
the zero-based number of the first bit beginning a sequence of unset bits of | the zero-based number of the first bit beginning a sequence of unset bits of | ||||
at least | at least | ||||
.Fa size | .Fa size | ||||
unset bits in the array of | unset bits in the array of | ||||
.Fa nbits | .Fa nbits | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
.Fa size | .Fa size | ||||
set bits in the array of | set bits in the array of | ||||
.Fa nbits | .Fa nbits | ||||
bits referenced by | bits referenced by | ||||
.Fa name , | .Fa name , | ||||
at or after the zero-based bit index | at or after the zero-based bit index | ||||
.Fa start . | .Fa start . | ||||
If no sequence of contiguous set bits of the specified | If no sequence of contiguous set bits of the specified | ||||
.Fa size | |||||
can be found at or after | |||||
.Fa start , | |||||
the location referenced by | |||||
.Fa value | |||||
is set to \-1. | |||||
.Pp | |||||
The | |||||
.Fn bit_ff_area_at | |||||
function stores in the location referenced by | |||||
.Fa value | |||||
the zero-based number of the first bit beginning a sequence of bits of | |||||
at least | |||||
.Fa size | |||||
bits in the array of | |||||
.Fa nbits | |||||
bits referenced by | |||||
.Fa name , | |||||
at or after the zero-based bit index | |||||
.Fa start | |||||
in which all bits have the value | |||||
.Fa match . | |||||
If no sequence of contiguous such bits of the specified | |||||
.Fa size | .Fa size | ||||
can be found at or after | can be found at or after | ||||
.Fa start , | .Fa start , | ||||
the location referenced by | the location referenced by | ||||
.Fa value | .Fa value | ||||
is set to \-1. | is set to \-1. | ||||
.Pp | .Pp | ||||
The | The | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |