dbertoni    2004/08/12 23:02:59

  Modified:    c/src/xalanc/PlatformSupport XalanBitmap.cpp XalanBitmap.hpp
  Log:
  In-line access functions.
  
  Revision  Changes    Path
  1.5       +3 -51     xml-xalan/c/src/xalanc/PlatformSupport/XalanBitmap.cpp
  
  Index: XalanBitmap.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanBitmap.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XalanBitmap.cpp   26 Feb 2004 22:34:18 -0000      1.4
  +++ XalanBitmap.cpp   13 Aug 2004 06:02:59 -0000      1.5
  @@ -27,8 +27,8 @@
   
   
   // Pre-constructed masks for bit twiddling.  Update these if not using chars 
for storing the bits.
  -static const int     theSetMasks[XalanBitmap::eBitsPerUnit] = { 1, 2, 4, 8, 
16, 32, 64, 128 };
  -static const int     theClearMasks[XalanBitmap::eBitsPerUnit] = { ~1, ~2, 
~4, ~8, ~16, ~32, ~64, ~128 };
  +const int    XalanBitmap::s_setMasks[XalanBitmap::eBitsPerUnit] = { 1, 2, 4, 
8, 16, 32, 64, 128 };
  +const int    XalanBitmap::s_clearMasks[XalanBitmap::eBitsPerUnit] = { ~1, 
~2, ~4, ~8, ~16, ~32, ~64, ~128 };
   
   
   
  @@ -46,58 +46,10 @@
   
   
   
  -bool
  -XalanBitmap::isSet(size_type theBit) const
  -{
  -     if (theBit >= m_size)
  -     {
  -             return false;
  -     }
  -     else
  -     {
  -             return m_bitmap[theBit / eBitsPerUnit] & theSetMasks[theBit % 
eBitsPerUnit] ? true : false;
  -     }
  -}
  -
  -
  -
  -void
  -XalanBitmap::set(size_type   theBit)
  -{
  -     if (theBit < m_size)
  -     {
  -             m_bitmap[theBit / eBitsPerUnit] |= theSetMasks[theBit % 
eBitsPerUnit];
  -     }
  -}
  -
  -
  -
  -void
  -XalanBitmap::clear(size_type theBit)
  -{
  -     if (theBit < m_size)
  -     {
  -             m_bitmap[theBit / eBitsPerUnit] &= theClearMasks[theBit % 
eBitsPerUnit];
  -     }
  -}
  -
  -
  -
  -void
  -XalanBitmap::toggle(size_type        theBit)
  -{
  -     if (theBit < m_size)
  -     {
  -             m_bitmap[theBit / eBitsPerUnit] ^= theSetMasks[theBit % 
eBitsPerUnit];
  -     }
  -}
  -
  -
  -
   void
   XalanBitmap::clearAll()
   {
  -     XALAN_STD_QUALIFIER fill(m_bitmap.begin(), m_bitmap.end(), 0);
  +     XALAN_STD_QUALIFIER fill(m_bitmap.begin(), m_bitmap.end(), '\0');
   }
   
   
  
  
  
  1.6       +30 -5     xml-xalan/c/src/xalanc/PlatformSupport/XalanBitmap.hpp
  
  Index: XalanBitmap.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanBitmap.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XalanBitmap.hpp   31 Jul 2004 06:05:04 -0000      1.5
  +++ XalanBitmap.hpp   13 Aug 2004 06:02:59 -0000      1.6
  @@ -67,7 +67,12 @@
         * @return true if the bit is set, false if not.
         */
        bool
  -     isSet(size_type         theBit) const;
  +     isSet(size_type         theBit) const
  +    {
  +         assert(theBit >= m_size);
  +
  +        return m_bitmap[theBit / eBitsPerUnit] & s_setMasks[theBit % 
eBitsPerUnit] ? true : false;
  +    }
   
        /**
         * Set a bit.
  @@ -75,7 +80,12 @@
         * @param theBit The number of the bit to set.
         */
        void
  -     set(size_type   theBit);
  +     set(size_type   theBit)
  +    {
  +         assert(theBit < m_size);
  +
  +             m_bitmap[theBit / eBitsPerUnit] |= s_setMasks[theBit % 
eBitsPerUnit];
  +    }
   
        /**
         * Clear a bit.
  @@ -83,7 +93,12 @@
         * @param theBit The number of the bit to clear.
         */
        void
  -     clear(size_type         theBit);
  +     clear(size_type         theBit)
  +    {
  +         assert(theBit < m_size);
  +
  +             m_bitmap[theBit / eBitsPerUnit] &= s_clearMasks[theBit % 
eBitsPerUnit];
  +    }
   
        /**
         * Toggle a bit.
  @@ -91,7 +106,12 @@
         * @param theBit The number of the bit to toggle.
         */
        void
  -     toggle(size_type        theBit);
  +     toggle(size_type        theBit)
  +    {
  +         assert(theBit < m_size);
  +
  +             m_bitmap[theBit / eBitsPerUnit] ^= s_setMasks[theBit % 
eBitsPerUnit];
  +    }
   
        /**
         * Clear all of the bits.
  @@ -112,7 +132,12 @@
   
   private:
   
  -     typedef XalanVector<UnitType>           BitmapVectorType;
  +    static const int    s_setMasks[];
  +
  +    static const int    s_clearMasks[];
  +
  +
  +    typedef XalanVector<UnitType>            BitmapVectorType;
   
        const size_type         m_size;
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to