+ // Classful scan
+ #if 1
+ {
+ const int addrClasses[] = {0,16,20,24,32,64};
+ const int numAddrClasses = sizeof(addrClasses)/sizeof(addrClasses[0]);
+ int i;
+ int first, last;
+ for( i = numAddrClasses; i -- > 1; )
+ {
+ first = 1 << (addrClasses[i-1] - 12);
+ last = (1 << (addrClasses[i] - 12)) - 1;
+ // Range is above the last free page
+ if( first > giLastPossibleFree )
+ continue;
+ // Last possible free page is in the range
+ if( last > giLastPossibleFree )
+ last = giLastPossibleFree;
+
+ // Scan the range
+ for( indx = first; indx < last; )
+ {
+ if( gaSuperBitmap[indx>>10] == -1 ) {
+ indx += 1024;
+ continue;
+ }
+
+ if( gaPageBitmap[indx>>5] == -1 ) {
+ indx += 32;
+ continue;
+ }
+
+ if( gaPageBitmap[indx>>5] & (1 << (indx&31)) ) {
+ indx ++;
+ continue;
+ }
+ break;
+ }
+ if( indx < last ) break;
+
+ giLastPossibleFree = first; // Well, we couldn't find any in this range
+ }
+ // Out of memory?
+ if( i <= 1 ) indx = -1;
+ }
+ #elif 0