[freenos] [freenos commit] r217 - BitMap now unconditionally uses 32-bit address pointers for scanning.

  • From: codesite-noreply@xxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Thu, 09 Jul 2009 22:30:52 +0000

Author: nieklinnenbank
Date: Thu Jul  9 15:30:36 2009
New Revision: 217

Modified:
   trunk/include/BitMap.h

Log:
BitMap now unconditionally uses 32-bit address pointers for scanning.


Modified: trunk/include/BitMap.h
==============================================================================
--- trunk/include/BitMap.h      (original)
+++ trunk/include/BitMap.h      Thu Jul  9 15:30:36 2009
@@ -77,11 +77,11 @@
         */
        Error markNext()
        {
-           Address *ptr;
-           Size num = count / sizeof(Address);
+           u32 *ptr;
+           Size num = count / sizeof(u32);

            /* At least one, and include partially used bytes. */
-           if (!num || count % sizeof(Address))
+           if (!num || count % sizeof(u32))
            {
                num++;
            }
@@ -89,19 +89,19 @@
            for (Size i = 0; i < num; i++)
            {
                /* Point to the correct offset. */
-               ptr = ((Address *) (map)) + i;
+               ptr = ((u32 *) (map)) + i;

                /* Any blocks free? */
-               if (*ptr != (Address) ~ZERO)
+               if (*ptr != (u32) ~ZERO)
                {
                    /* Find the first free bit. */
-                   for (Size bit = 0; bit < sizeof(Address) * 8; bit++)
+                   for (Size bit = 0; bit < sizeof(u32) * 8; bit++)
                    {
-                       if (!(*ptr & 1 << bit))
+                       if (!(*ptr & (1 << bit)))
                        {
                            *ptr |= (1 << bit);
                            free--;
-                           return bit + (sizeof(Address) * 8 * i);
+                           return bit + (sizeof(u32) * 8 * i);
                        }
                    }
                }

Other related posts:

  • » [freenos] [freenos commit] r217 - BitMap now unconditionally uses 32-bit address pointers for scanning. - codesite-noreply