#12 closed defect (fixed)
Questions for psBitMask (SDR Section 4.1)
| Reported by: | Owned by: | Paul Price | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Below are questions about the coding of the psBitMask utility and requests for
changes in the documentation and coding implementation.
- Name. Can we change the name to psBitset rather than psBitMask? Bitset
classes are common in other libraries/languages and are close to the requested
psBitMask functionality. Bit masks are generally thought of as constants used
in binary operations, whereas bit sets are mutable, arbitrary length sets of
bits.
- In the psBitMask struct definition, the *bits term is an array of bytes, not
an array of bits, correct? I ask because some people actually store one char in
each array index as the character representation of '1' or '0', not the hex
value. (i.e. bits[0] = '1' not bit[0] = 0x01)
- The definition of the psBitMask constructor argument is number of bytes, not
number of bits?
- I'd like to add a psPrintBitMask() function to return an array of chars so
that the bit mask can be printed in binary notation (i.e. "1101110101110").
This could be used to check results of binary operations for those of us who
can't do them in our heads.
- Should the pointer arguments to psBitMaskSet() and psBitMaskTest() be
restricted?
Change History (6)
comment:1 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 22 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
The bug resolution mentions adding API for printing the contents of the bit set,
but SDR-06 does not contain this function. The following is the function
implemented in code:
char *psBitSetToString( const pBitSet* restrict inMask);
Converts the contents of a psBitSet to a string representation of its binary
form of ones and zeros. The LSB is the rightmost character. Each set of eight
characters represents one byte.
Do we want to add this to the SDRS?
comment:3 by , 22 years ago
| Owner: | changed from to |
|---|---|
| Status: | reopened → new |
comment:4 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Added psBitSetToString to the SDRS.
char *psBitSetToString(const pBitSet* bits);
Finally, \code{psBitSetToString} returns a string representation of
the specified \code{bits}.
comment:5 by , 22 years ago
| Keywords: | VERIFIED added |
|---|
Should be fixed in SDRS-07 and ADD-06 (7 September 2004).
comment:6 by , 22 years ago
| Keywords: | VERIFIED removed |
|---|

files to match.
element available. I have added wording to the SDRS to clarify this.
function should alloc ceil(n/8) bytes. I've added wording to the SDRS to
clarify this.
to reflect this.