Changeset 518 for trunk/doc/pslib/psLibSDRS.tex
- Timestamp:
- Apr 26, 2004, 2:33:18 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r516 r518 1 %%% $Id: psLibSDRS.tex,v 1.3 7 2004-04-26 22:19:55 price Exp $1 %%% $Id: psLibSDRS.tex,v 1.38 2004-04-27 00:33:18 eugene Exp $ 2 2 \documentclass[panstarrs]{panstarrs} 3 3 … … 1465 1465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1466 1466 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 1469 Bitsets are required in order to turn options on and off. We 1470 require the capability to have a bitset of arbitrary length (i.e., 1471 not 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 1474 of each byte in the array, with 8 bits available for each byte in the 1475 array. Also note that the constructor is passed the number of 1476 required bits, which implies that \code{ceil(n / 8)} bytes must be 1477 allocated. 1478 1479 \begin{verbatim} 1480 /** A bitset of arbitrary length. */ 1475 1481 typedef struct { 1476 int n; ///< Number of chars that form the mask1482 int n; ///< Number of chars that form the bitset 1477 1483 char *bits; ///< The bits 1478 } psBit Mask;1484 } psBitset; 1479 1485 \end{verbatim} 1480 1486 … … 1483 1489 \begin{verbatim} 1484 1490 /** Constructor */ 1485 psBit Mask *psBitMaskAlloc(int n ///< Number of bits required1491 psBitset *psBitsetAlloc(int n ///< Number of bits required 1486 1492 ); 1487 1493 1488 1494 /** Destructor */ 1489 void psBit MaskFree(psBitMask *restrict myMask ///< Bit maskto destroy1490 ); 1491 \end{verbatim} 1492 1493 Four basic operations on bit masks are required:1495 void psBitsetFree(psBitset *restrict myBits ///< bitset to destroy 1496 ); 1497 \end{verbatim} 1498 1499 Four basic operations on bitsets are required: 1494 1500 \begin{itemize} 1495 1501 \item Set a bit; 1496 1502 \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. 1498 1504 \end{itemize} 1499 1505 The corresponding APIs are defined below. 1500 1506 1501 1507 \begin{verbatim} 1502 /** Set a bit mask*/1503 psBit Mask*1504 psBit MaskSet(psBitMask *myMask, ///< Input bit mask1505 int bit ///< Bit to set1506 ); 1507 \end{verbatim} 1508 1509 \code{psBit MaskSet} sets the specified \code{bit} in the1510 \code{psBit Mask}, and returns the updated bitmask. The input bitmask1508 /** Set a bitset */ 1509 psBitset * 1510 psBitsetSet(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 1511 1517 will be modified. 1512 1518 1513 1519 \begin{verbatim} 1514 /** Check a bit mask. Returns true or false */1520 /** Check a bitset. Returns true or false */ 1515 1521 int 1516 psBit MaskTest(const psBitMask *checkMask, ///< Bit maskto check1522 psBitsetTest(const psBitset *restrict checkBits, ///< bitset to check 1517 1523 int bit ///< Bit to check 1518 1524 ); 1519 1525 \end{verbatim} 1520 1526 1521 \code{psBit MaskTest} returns a true value if the specified \code{bit}1527 \code{psBitsetTest} returns a true value if the specified \code{bit} 1522 1528 is set; otherwise, it returns a false value. 1523 1529 1524 1530 \begin{verbatim} 1525 /** apply the given operator to two bit masks */1526 psBit Mask*1527 psBit MaskOp(psBitMask *outMask, ///< Output bit maskor NULL1528 const psBit Mask *restrict inMask1, ///< Input bit mask11529 char *operator, ///< bit maskoperator (AND, OR, XOR)1530 const psBit Mask *restrict inMask2 ///< Input bit mask21531 ); 1532 \end{verbatim} 1533 1534 \code{psBit MaskOp} returns the \code{psBitMask} that is the result of1531 /** apply the given operator to two bitsets */ 1532 psBitset * 1533 psBitsetOp(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 1535 1541 performing the specified \code{operator} (one of \code{"AND"}, 1536 \code{"OR"}, or \code{"XOR"}) on \code{in Mask1} and \code{inMask2}.1542 \code{"OR"}, or \code{"XOR"}) on \code{inBits1} and \code{inBits2}. 1537 1543 1538 1544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 1551 1557 psFloatArray * 1552 1558 psSort(psFloatArray *out, ///< Sorted array to return. May be NULL 1553 const psFloatArray * myArray ///< Array to sort1559 const psFloatArray *restrict myArray ///< Array to sort 1554 1560 ); 1555 1561 \end{verbatim}
Note:
See TracChangeset
for help on using the changeset viewer.
