IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 26, 2004, 2:33:18 PM (22 years ago)
Author:
eugene
Message:

bitmask moved to bitset
added restricts to psSort stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r516 r518  
    1 %%% $Id: psLibSDRS.tex,v 1.37 2004-04-26 22:19:55 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.38 2004-04-27 00:33:18 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    14651465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    14661466
    1467 \subsection{Bit masks}
    1468 
    1469 Bit masks are required in order to turn options on and off.  We require the
    1470 capability to have a bit mask of arbitrary length (i.e., not limited by the
    1471 length of a \code{long}, say).
    1472 
    1473 \begin{verbatim}
    1474 /** A bitmask of arbitrary length. */
     1467\subsection{Bitsets}
     1468
     1469Bitsets are required in order to turn options on and off.  We
     1470require the capability to have a bitset of arbitrary length (i.e.,
     1471not limited by the length of a \code{long}, say).  The
     1472\code{psBitset} structure is defined below.  Note that the entry
     1473\code{bits} is an array of type \code{char} storing the bits as bits
     1474of each byte in the array, with 8 bits available for each byte in the
     1475array.  Also note that the constructor is passed the number of
     1476required bits, which implies that \code{ceil(n / 8)} bytes must be
     1477allocated.
     1478
     1479\begin{verbatim}
     1480/** A bitset of arbitrary length. */
    14751481typedef struct {
    1476     int n;                              ///< Number of chars that form the mask
     1482    int n;                              ///< Number of chars that form the bitset
    14771483    char *bits;                         ///< The bits
    1478 } psBitMask;
     1484} psBitset;
    14791485\end{verbatim}
    14801486
     
    14831489\begin{verbatim}
    14841490/** Constructor */
    1485 psBitMask *psBitMaskAlloc(int n         ///< Number of bits required
     1491psBitset *psBitsetAlloc(int n         ///< Number of bits required
    14861492    );
    14871493 
    14881494/** Destructor */
    1489 void psBitMaskFree(psBitMask *restrict myMask ///< Bit mask to destroy
    1490     );
    1491 \end{verbatim}
    1492 
    1493 Four basic operations on bit masks are required:
     1495void psBitsetFree(psBitset *restrict myBits ///< bitset to destroy
     1496    );
     1497\end{verbatim}
     1498
     1499Four basic operations on bitsets are required:
    14941500\begin{itemize}
    14951501\item Set a bit;
    14961502\item Check if a bit is set; and
    1497 \item \code{OR}, \code{AND} and \code{XOR} two bit masks.
     1503\item \code{OR}, \code{AND} and \code{XOR} two bitsets.
    14981504\end{itemize}
    14991505The corresponding APIs are defined below.
    15001506
    15011507\begin{verbatim}
    1502 /** Set a bit mask */
    1503 psBitMask *
    1504 psBitMaskSet(psBitMask *myMask,         ///< Input bit mask
    1505              int bit                    ///< Bit to set
    1506     );
    1507 \end{verbatim}
    1508 
    1509 \code{psBitMaskSet} sets the specified \code{bit} in the
    1510 \code{psBitMask}, and returns the updated bitmask.  The input bitmask
     1508/** Set a bitset */
     1509psBitset *
     1510psBitsetSet(psBitset *restrict myBits, ///< Input bitset
     1511             int bit                     ///< Bit to set
     1512    );
     1513\end{verbatim}
     1514
     1515\code{psBitsetSet} sets the specified \code{bit} in the
     1516\code{psBitset}, and returns the updated bitset.  The input bitset
    15111517will be modified.
    15121518
    15131519\begin{verbatim}
    1514 /** Check a bit mask.  Returns true or false */
     1520/** Check a bitset.  Returns true or false */
    15151521int
    1516 psBitMaskTest(const psBitMask *checkMask, ///< Bit mask to check
     1522psBitsetTest(const psBitset *restrict checkBits, ///< bitset to check
    15171523              int bit                   ///< Bit to check
    15181524    );
    15191525\end{verbatim}
    15201526
    1521 \code{psBitMaskTest} returns a true value if the specified \code{bit}
     1527\code{psBitsetTest} returns a true value if the specified \code{bit}
    15221528is set; otherwise, it returns a false value.
    15231529
    15241530\begin{verbatim}
    1525 /** apply the given operator to two bit masks */
    1526 psBitMask *
    1527 psBitMaskOp(psBitMask *outMask,         ///< Output bit mask or NULL
    1528             const psBitMask *restrict inMask1, ///< Input bit mask 1
    1529             char *operator,             ///< bit mask operator (AND, OR, XOR)
    1530             const psBitMask *restrict inMask2 ///< Input bit mask 2
    1531     );
    1532 \end{verbatim}
    1533 
    1534 \code{psBitMaskOp} returns the \code{psBitMask} that is the result of
     1531/** apply the given operator to two bitsets */
     1532psBitset *
     1533psBitsetOp(psBitset *outBits,         ///< Output bitset or NULL
     1534            const psBitset *restrict inBits1, ///< Input bitset 1
     1535            char *operator,             ///< bitset operator (AND, OR, XOR)
     1536            const psBitset *restrict inBits2 ///< Input bitset 2
     1537    );
     1538\end{verbatim}
     1539
     1540\code{psBitsetOp} returns the \code{psBitset} that is the result of
    15351541performing the specified \code{operator} (one of \code{"AND"},
    1536 \code{"OR"}, or \code{"XOR"}) on \code{inMask1} and \code{inMask2}.
     1542\code{"OR"}, or \code{"XOR"}) on \code{inBits1} and \code{inBits2}.
    15371543
    15381544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    15511557psFloatArray *
    15521558psSort(psFloatArray *out,               ///< Sorted array to return. May be NULL
    1553        const psFloatArray *myArray      ///< Array to sort
     1559       const psFloatArray *restrict myArray      ///< Array to sort
    15541560    );
    15551561\end{verbatim}
Note: See TracChangeset for help on using the changeset viewer.