LoBits.C

Go to the documentation of this file.
00001 /**
00002    \file  Robots/LoBot/util/LoBits.C
00003    \brief Bit fiddling functions.
00004 */
00005 
00006 // //////////////////////////////////////////////////////////////////// //
00007 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00008 // by the University of Southern California (USC) and the iLab at USC.  //
00009 // See http://iLab.usc.edu for information about this project.          //
00010 // //////////////////////////////////////////////////////////////////// //
00011 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00012 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00013 // in Visual Environments, and Applications'' by Christof Koch and      //
00014 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00015 // pending; application number 09/912,225 filed July 23, 2001; see      //
00016 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00017 // //////////////////////////////////////////////////////////////////// //
00018 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00019 //                                                                      //
00020 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00021 // redistribute it and/or modify it under the terms of the GNU General  //
00022 // Public License as published by the Free Software Foundation; either  //
00023 // version 2 of the License, or (at your option) any later version.     //
00024 //                                                                      //
00025 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00026 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00027 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00028 // PURPOSE.  See the GNU General Public License for more details.       //
00029 //                                                                      //
00030 // You should have received a copy of the GNU General Public License    //
00031 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00032 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00033 // Boston, MA 02111-1307 USA.                                           //
00034 // //////////////////////////////////////////////////////////////////// //
00035 //
00036 // Primary maintainer for this file: mviswana usc edu
00037 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/util/LoBits.C $
00038 // $Id: LoBits.C 13037 2010-03-23 01:00:53Z mviswana $
00039 //
00040 
00041 //------------------------------ HEADERS --------------------------------
00042 
00043 // lobot headers
00044 #include "Robots/LoBot/util/LoBits.H"
00045 
00046 //----------------------------- NAMESPACE -------------------------------
00047 
00048 namespace lobot {
00049 
00050 //---------------------- BIT FIDDLING FUNCTIONS -------------------------
00051 
00052 // Set a bit in a register to the specified value. The bit to be set or
00053 // cleared is identified by the given mask.
00054 int set_bit(int reg, int mask, bool val)
00055 {
00056    if (val) // bit is to be set
00057       reg |= mask ;
00058    else // bit is to be cleared
00059       reg &= ~mask ;
00060    return reg ;
00061 }
00062 
00063 //-----------------------------------------------------------------------
00064 
00065 } // end of namespace encapsulating this file's definitions
00066 
00067 /* So things look consistent in everyone's emacs... */
00068 /* Local Variables: */
00069 /* indent-tabs-mode: nil */
00070 /* End: */
Generated on Sun May 8 08:41:31 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3