IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 22 years ago

Closed 22 years ago

Last modified 22 years ago

#12 closed defect (fixed)

Questions for psBitMask (SDR Section 4.1)

Reported by: calvin.harman@… 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 eugene, 22 years ago

Resolution: fixed
Status: newclosed
  • Name: I agree with BitMask -> Bitset. I have changed the SDRS & our IP3 *.h

files to match.

  • psBitMask.bits : yes, this is an array of bytes, with up to 8 bits per array

element available. I have added wording to the SDRS to clarify this.

  • psBitMaskAlloc (now psBitsetAlloc) : nbits is number of bits required. the

function should alloc ceil(n/8) bytes. I've added wording to the SDRS to
clarify this.

  • psPrintBitset : please do add this, and send me your APIs
  • restricts : they probably should be restricted - i've adjusted the SDRS & .h

to reflect this.

comment:2 by Eric.VanAlst@…, 22 years ago

Resolution: fixed
Status: closedreopened

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 eugene, 22 years ago

Owner: changed from eugene to Paul Price
Status: reopenednew

comment:4 by Paul Price, 22 years ago

Resolution: fixed
Status: newclosed

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 Paul Price, 22 years ago

Keywords: VERIFIED added

Should be fixed in SDRS-07 and ADD-06 (7 September 2004).

comment:6 by Paul Price, 22 years ago

Keywords: VERIFIED removed
Note: See TracTickets for help on using tickets.