IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2004, 4:43:59 PM (22 years ago)
Author:
harman
Message:

Added Doxygen comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psBitMask.c

    r437 r438  
    1 #include "psBitMask.h"
     1/** @file  psBitMask.c
     2 *
     3 *  @brief Creates an array of bits of arbitrary length.
     4 *
     5 *  Bit masks are useful for turning options on and off. This module provides functions to create an array of
     6 *  bits of arbitrary length and manipulate them with basic binary operations. A print function is also
     7 *  provided to display the entire set of bits in binary form.
     8 *
     9 *  @author Ross Harman, MHPCC
     10 *   
     11 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-04-17 02:43:59 $
     13 *
     14 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     15 */
    216
     17/******************************************************************************/
     18/*  INCLUDE FILES                                                             */
     19/******************************************************************************/
    320#include <stdlib.h>
    421#include <string.h>
     
    623#include <ctype.h>
    724
    8 static char* getByte(int bit, const psBitMask* inMask);
    9 static char mask(int bit);
     25#include "psBitMask.h"
     26//#include "psMemory.h"
    1027
     28/*****************************************************************************/
     29/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
     30/*****************************************************************************/
     31static char* getByte(int bit, const psBitMask *restrict inMask)
     32{
     33    int index = 0;
     34    char *byte = 0;
     35    index = bit/8;
     36    byte = inMask->bits+index;
     37   
     38    return byte;
     39}
     40
     41static char mask(int bit)
     42{
     43    char mask = 0x01;
     44    mask = mask << (bit%8);
     45   
     46    return mask;
     47}
     48
     49/*****************************************************************************/
     50/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
     51/*****************************************************************************/
    1152psBitMask* psBitMaskAlloc(int n)
    1253{
     54//    psBitMask *newObj = (psBitMask*)psAlloc(sizeof(psBitMask));
    1355    psBitMask *newObj = (psBitMask*)malloc(sizeof(psBitMask));
    1456    newObj->n = n;
     
    4385}
    4486
    45 psBitMask* psBitMaskOp(psBitMask *outMask, const psBitMask *restrict inMask1, char *operator, const psBitMask *restrict inMask2)
     87psBitMask* psBitMaskOp(psBitMask *outMask, const psBitMask *restrict inMask1, char *operator,
     88                       const psBitMask *restrict inMask2)
    4689{
    4790    int i = 0;
     
    118161    return outString;
    119162}
    120 
    121 /* 0 based index of byte array's byte that contains containing bit */
    122 static char* getByte(int bit, const psBitMask* inMask)
    123 {
    124     int index = 0;
    125     char *byte = 0;
    126     index = bit/8;
    127     byte = inMask->bits+index;
    128    
    129     return byte;
    130 }
    131 
    132 static char mask(int bit)
    133 {
    134     char mask = 0x01;
    135     mask = mask << (bit%8);
    136    
    137     return mask;
    138 }
Note: See TracChangeset for help on using the changeset viewer.